Adde camera class
This commit is contained in:
parent
8a49c12909
commit
326094caf3
16
cpp/src/camera.cpp
Normal file
16
cpp/src/camera.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "camera.hpp"
|
||||
#include "math.hpp"
|
||||
|
||||
|
||||
// for now only pass-through placeholder functions,
|
||||
// since we draw the whole map
|
||||
|
||||
WindowPos Camera::WorldToWindow(WorldPos world) const
|
||||
{
|
||||
return WindowPos{world[0], world[1]};
|
||||
}
|
||||
|
||||
WorldPos Camera::WindowToWorld(WindowPos window) const
|
||||
{
|
||||
return WorldPos{window[0], window[1]};
|
||||
}
|
16
cpp/src/camera.hpp
Normal file
16
cpp/src/camera.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "math.hpp"
|
||||
|
||||
class Camera
|
||||
{
|
||||
public:
|
||||
WindowPos WorldToWindow(WorldPos) const;
|
||||
WorldPos WindowToWorld(WindowPos) const;
|
||||
|
||||
private:
|
||||
// TODO this should be replaced with a matrix
|
||||
float m_Zoom;
|
||||
WorldPos m_RectCorner; // upper left corner (0,0) of the drawn regios
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user