53 lines
902 B
C++
53 lines
902 B
C++
/*
|
|
* RenderContext.h
|
|
*
|
|
* Created on: Nov 30, 2016
|
|
* Author: tibi
|
|
*/
|
|
|
|
#ifndef GRAPHICS_RENDERCONTEXT_H_
|
|
#define GRAPHICS_RENDERCONTEXT_H_
|
|
|
|
#include <base/Viewport.h>
|
|
#include <SDL2/SDL.h>
|
|
|
|
namespace farmlands {
|
|
namespace base {
|
|
|
|
class GameObject;
|
|
struct Transform;
|
|
struct Camera;
|
|
|
|
class RenderContext
|
|
{
|
|
public:
|
|
float xToWorld(float x);
|
|
float yToWorld(float y);
|
|
float xToScreen(float x);
|
|
float yToScreen(float y);
|
|
|
|
bool visible(SDL_Rect& rect);
|
|
|
|
inline GameObject* cameraObj() { return m_cameraObj; }
|
|
inline Camera* camera() { return m_camera; }
|
|
inline Transform* cameraTransform() { return m_cameraTransform; }
|
|
|
|
void setCamera(GameObject* camera);
|
|
|
|
/**
|
|
* Screen properties
|
|
*/
|
|
Viewport viewport;
|
|
float uiScale = 1.0f;
|
|
|
|
private:
|
|
Transform* m_cameraTransform;
|
|
Camera* m_camera;
|
|
GameObject* m_cameraObj;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* GRAPHICS_RENDERCONTEXT_H_ */
|