Rendering player and tiles now works.
This commit is contained in:
60
src/graphics/GameRenderer.h
Normal file
60
src/graphics/GameRenderer.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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_ */
|
Reference in New Issue
Block a user