summary refs log tree commit diff stats
path: root/src/camera_system.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-03 01:11:31 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-03 01:11:31 -0500
commit24918837c3ff9026d228657d14852c9cf39a5644 (patch)
treebe131a43eb30f164bd70f542cfcaec688fbc3d51 /src/camera_system.h
parentf449345e3aeb599eb497dfeeac7027cf4d1de515 (diff)
downloadtanetane-24918837c3ff9026d228657d14852c9cf39a5644.tar.gz
tanetane-24918837c3ff9026d228657d14852c9cf39a5644.tar.bz2
tanetane-24918837c3ff9026d228657d14852c9cf39a5644.zip
Added camera system
Diffstat (limited to 'src/camera_system.h')
-rw-r--r--src/camera_system.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/camera_system.h b/src/camera_system.h new file mode 100644 index 0000000..3eb8374 --- /dev/null +++ b/src/camera_system.h
@@ -0,0 +1,38 @@
1#ifndef CAMERA_SYSTEM_H_D52ADAD3
2#define CAMERA_SYSTEM_H_D52ADAD3
3
4#include "consts.h"
5#include "system.h"
6#include "vector.h"
7
8class Game;
9
10class CameraSystem : public System {
11public:
12
13 static constexpr SystemKey Key = SystemKey::Camera;
14
15 CameraSystem(Game& game) : game_(game) {}
16
17 const vec2i& getCameraPosition() const { return pos_; }
18
19 const vec2i& getFieldOfView() const { return fov_; }
20
21 void setFollowingSprite(int spriteId) { followingSprite_ = spriteId; }
22
23 void lockCamera() { locked_ = true; }
24
25 void unlockCamera() { locked_ = false; }
26
27 void tick(double dt) override;
28
29private:
30 Game& game_;
31
32 vec2i pos_;
33 vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT };
34 int followingSprite_;
35 bool locked_ = true;
36};
37
38#endif /* end of include guard: CAMERA_SYSTEM_H_D52ADAD3 */