OpenGLESRenderer::OpenGLESRenderer() : Renderer() { m_spriteBatcher = std::unique_ptr<SpriteBatcher>(new SpriteBatcher(1000, false)); m_spriteBatcherWithColor = std::unique_ptr<SpriteBatcher>(new SpriteBatcher(1000, true)); m_gameTexture = load_png_asset_into_texture("game.png"); m_backgroundTexture = load_png_asset_into_texture("background.png"); }
Tile::Tile(int x, int y, int z){ width = 2; height = 2; this->x = x*2 + width/2; this->y = -y*2 - height/2; this->z = z; std::string tileName = std::to_string(-1*z) + "/" + std::to_string(x) + "/" + std::to_string(y); std::string tilePath = "textures/" + tileName + ".png"; texture = load_png_asset_into_texture(tilePath.c_str()); program = build_program_from_assets("shaders/simple.vsh", "shaders/simple.fsh"); glUseProgram(program); _positionSlot = glGetAttribLocation(program, "Position"); _modelViewUniform = glGetUniformLocation(program, "Modelview"); glEnableVertexAttribArray(_positionSlot); _texCoordSlot = glGetAttribLocation(program, "TexCoordIn"); glEnableVertexAttribArray(_texCoordSlot); _textureUniform = glGetUniformLocation(program, "Texture"); }