Adde camera class

This commit is contained in:
Jan Mrna 2025-10-04 17:10:20 +02:00
parent 1ac55d7e10
commit 79dd655e96
2 changed files with 32 additions and 0 deletions

16
cpp/src/camera.cpp Normal file
View 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
View 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
};