<commit_before>#include "tangram.h"

#include "platform.h"
#include "scene/scene.h"
#include "scene/sceneLoader.h"
#include "style/style.h"
#include "text/fontContext.h"
#include "labels/labels.h"
#include "tile/tileManager.h"
#include "tile/tile.h"
#include "gl/error.h"
#include "gl/shaderProgram.h"
#include "scene/skybox.h"
#include "view/view.h"
#include "gl/renderState.h"
#include "gl/primitives.h"
#include "util/inputHandler.h"
#include <memory>
#include <cmath>
#include <bitset>

namespace Tangram {

std::unique_ptr<TileManager> m_tileManager;
std::shared_ptr<Scene> m_scene;
std::shared_ptr<View> m_view;
std::unique_ptr<Labels> m_labels;
std::shared_ptr<FontContext> m_ftContext;
std::unique_ptr<Skybox> m_skybox;
std::unique_ptr<InputHandler> m_inputHandler;

static float g_time = 0.0;
static std::bitset<8> g_flags = 0;

void initialize(const char* _scenePath) {

    logMsg("initialize\n");

    if (!m_tileManager) {

        // Create view
        m_view = std::make_shared<View>();

        // Create a scene object
        m_scene = std::make_shared<Scene>();

        // Input handler
        m_inputHandler = std::unique_ptr<InputHandler>(new InputHandler(m_view));

        m_skybox = std::unique_ptr<Skybox>(new Skybox("cubemap.png"));
        m_skybox->init();

        // Create a tileManager
        m_tileManager = TileManager::GetInstance();

        // Pass references to the view and scene into the tile manager
        m_tileManager->setView(m_view);
        m_tileManager->setScene(m_scene);

        // Font and label setup
        m_ftContext = FontContext::GetInstance();
        m_ftContext->addFont("FiraSans-Medium.ttf", "FiraSans");
        m_labels = std::unique_ptr<Labels>(new Labels());

        logMsg("Loading Tangram scene file: %s\n", _scenePath);
        auto sceneString = stringFromResource(_scenePath);

        SceneLoader loader;

        loader.loadScene(sceneString, *m_scene, *m_tileManager, *m_view);

        Primitives::setColor(0xffffff);
        RenderState::configure();
    }

    while (Error::hadGlError("Tangram::initialize()")) {}

    logMsg("finish initialize\n");

}

void resize(int _newWidth, int _newHeight) {

    logMsg("resize: %d x %d\n", _newWidth, _newHeight);<commit_msg>WIP - explicitly set font ttf in tangram.cpp<commit_after>#include "tangram.h"

#include "platform.h"
#include "scene/scene.h"
#include "scene/sceneLoader.h"
#include "style/style.h"
#include "text/fontContext.h"
#include "labels/labels.h"
#include "tile/tileManager.h"
#include "tile/tile.h"
#include "gl/error.h"
#include "gl/shaderProgram.h"
#include "scene/skybox.h"
#include "view/view.h"
#include "gl/renderState.h"
#include "gl/primitives.h"
#include "util/inputHandler.h"
#include <memory>
#include <cmath>
#include <bitset>

namespace Tangram {

std::unique_ptr<TileManager> m_tileManager;
std::shared_ptr<Scene> m_scene;
std::shared_ptr<View> m_view;
std::unique_ptr<Labels> m_labels;
std::shared_ptr<FontContext> m_ftContext;
std::unique_ptr<Skybox> m_skybox;
std::unique_ptr<InputHandler> m_inputHandler;

static float g_time = 0.0;
static std::bitset<8> g_flags = 0;

void initialize(const char* _scenePath) {

    logMsg("initialize\n");

    if (!m_tileManager) {

        // Create view
        m_view = std::make_shared<View>();

        // Create a scene object
        m_scene = std::make_shared<Scene>();

        // Input handler
        m_inputHandler = std::unique_ptr<InputHandler>(new InputHandler(m_view));

        m_skybox = std::unique_ptr<Skybox>(new Skybox("cubemap.png"));
        m_skybox->init();

        // Create a tileManager
        m_tileManager = TileManager::GetInstance();

        // Pass references to the view and scene into the tile manager
        m_tileManager->setView(m_view);
        m_tileManager->setScene(m_scene);

        // Font and label setup
        std::string fontsPath = deviceFontsPath();
        m_ftContext = FontContext::GetInstance();
        //m_ftContext->addFont("FiraSans-Medium.ttf", "FiraSans", fontsPath);
        m_ftContext->addFont("Roboto-Regular.ttf", "RobotoRegular", fontsPath);
        m_labels = std::unique_ptr<Labels>(new Labels());

        logMsg("Loading Tangram scene file: %s\n", _scenePath);
        auto sceneString = stringFromResource(_scenePath);

        SceneLoader loader;

        loader.loadScene(sceneString, *m_scene, *m_tileManager, *m_view);

        Primitives::setColor(0xffffff);
        RenderState::configure();
    }

    while (Error::hadGlError("Tangram::initialize()")) {}

    logMsg("finish initialize\n");

}

void resize(int _newWidth, int _newHeight) {

    logMsg("resize: %d x %d\n", _newWidth, _newHeight);
{'fraction_non_alphanumeric': 0.14178945120649156, 'fraction_numerical': 0.002135383301302584, 'mean_word_length': 3.9150052465897165, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6677265', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1553, 'n_words': 310}