61 lines
944 B
C++
61 lines
944 B
C++
/*
|
|
* GameRenderer.h
|
|
*
|
|
* Created on: Nov 13, 2016
|
|
* Author: tibi
|
|
*/
|
|
|
|
#ifndef GRAPHICS_GAMERENDERER_H_
|
|
#define GRAPHICS_GAMERENDERER_H_
|
|
|
|
#include <graphics/SdlRenderer.h>
|
|
#include <resources/ResourceManager.h>
|
|
|
|
#include <memory>
|
|
|
|
#include <SDL2/SDL.h>
|
|
|
|
namespace farmlands {
|
|
|
|
// Forward declarations
|
|
struct GameState;
|
|
|
|
namespace graphics {
|
|
|
|
class GameRenderer
|
|
{
|
|
public:
|
|
GameRenderer();
|
|
virtual ~GameRenderer();
|
|
|
|
/**
|
|
* Initializes game renderer
|
|
*/
|
|
void initialize(GameState* gameState);
|
|
|
|
/**
|
|
* Renders everything
|
|
*/
|
|
void render();
|
|
|
|
private:
|
|
void prepareRender();
|
|
void renderTileLayers();
|
|
void renderPlayer();
|
|
|
|
float xToWorld(float x);
|
|
float yToWorld(float y);
|
|
float xToScreen(float x);
|
|
float yToScreen(float y);
|
|
|
|
GameState* m_gameState;
|
|
|
|
// Size of a cell (scaled)
|
|
float m_cellW, m_cellH;
|
|
};
|
|
|
|
} /* namespace graphics */
|
|
} /* namespace farmlands */
|
|
|
|
#endif /* GRAPHICS_GAMERENDERER_H_ */
|