<commit_before>#include "lua_game_state.h"

#include "tmx.h"
#include "shader.h"
#include "tiled_map.h"

#include <glm/gtx/transform.hpp>

#include <iostream>

namespace te
{
    LuaGameState::LuaGameState(std::shared_ptr<TMX> pTMX)
        : LuaGameState(pTMX, AssetManager(pTMX))
    {}
    LuaGameState::LuaGameState(std::shared_ptr<TMX> pTMX, const AssetManager& assets)
        : mpShader(new Shader(glm::ortho<GLfloat>(0, 16, 9, 0, -100, 100)))
        , mAssets(assets)
        , mECS(mpShader)
        , mLuaStateECS(mECS)
        , mpTiledMap(nullptr)
    {
        glm::mat4 model = glm::scale(glm::vec3(1.f / pTMX->tilewidth, 1.f / pTMX->tileheight, 1.f));
        mpTiledMap = std::shared_ptr<TiledMap>(new TiledMap(pTMX, mpShader, model, assets.pTextureManager.get()));
        loadObjects(*pTMX, model, mAssets, mECS);
        try {
            mLuaStateECS.loadScript(pTMX->meta.path + "/main.lua");
            mLuaStateECS.runScript();
        } catch (const std::runtime_error&) {
            std::clog << "Warning: LuaGameState: Could not load main.lua" << std::endl;
        }
    }

    bool LuaGameState::processInput(const SDL_Event&) { return false; }
    bool LuaGameState::update(float dt)
    {
        te::update(mECS, dt);
        return false;
    }
    void LuaGameState::draw()
    {
        mpTiledMap->draw();
        te::draw(mECS);
    }

    void LuaGameState::runConsole()<commit_msg>Include Camera in TiledMap draw call<commit_after>#include "lua_game_state.h"

#include "tmx.h"
#include "shader.h"
#include "tiled_map.h"
#include "camera.h"

#include <glm/gtx/transform.hpp>

#include <iostream>
#include <cassert>

namespace te
{
    LuaGameState::LuaGameState(std::shared_ptr<TMX> pTMX)
        : LuaGameState(pTMX, AssetManager(pTMX))
    {}
    LuaGameState::LuaGameState(std::shared_ptr<TMX> pTMX, const AssetManager& assets)
        : mpShader(new Shader(glm::ortho<GLfloat>(0, 16, 9, 0, -100, 100)))
        , mAssets(assets)
        , mECS(mpShader)
        , mLuaStateECS(mECS)
        , mpTiledMap(nullptr)
    {
        assert(pTMX);

        glm::mat4 model = glm::scale(glm::vec3(1.f / pTMX->tilewidth, 1.f / pTMX->tileheight, 1.f));
        mpTiledMap = std::shared_ptr<TiledMap>(new TiledMap(pTMX, mpShader, model, assets.pTextureManager.get()));
        loadObjects(*pTMX, model, mAssets, mECS);
        try {
            mLuaStateECS.loadScript(pTMX->meta.path + "/main.lua");
            mLuaStateECS.runScript();
        } catch (const std::runtime_error& ex) {
            std::clog << "Warning: LuaGameState: Could not load main.lua." << std::endl;
            std::clog << ex.what() << std::endl;
        }
    }

    bool LuaGameState::processInput(const SDL_Event&) { return false; }
    bool LuaGameState::update(float dt)
    {
        te::update(mECS, dt);
        return false;
    }
    void LuaGameState::draw()
    {
        mpTiledMap->draw(mECS.pCamera->getView());
        te::draw(mECS);
    }

    void LuaGameState::runConsole()
{'fraction_non_alphanumeric': 0.15108153078202996, 'fraction_numerical': 0.01064891846921797, 'mean_word_length': 2.9709379128137385, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 25, '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': '5612228', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1113, 'n_words': 181}