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-16 22:03:10 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-16 22:03:10 -0500
commita645524d19bb9183d4eece72bf8945bba4bed3a0 (patch)
treeca45cb80f73def5bd6bd8d7ec46bb90c826be848 /src/camera_system.h
parentc5a96f0ee23a3dbe1a6dab0a1062cf25b7a2aba4 (diff)
downloadtanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.tar.gz
tanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.tar.bz2
tanetane-a645524d19bb9183d4eece72bf8945bba4bed3a0.zip
Added scriptable camera panning
Diffstat (limited to 'src/camera_system.h')
-rw-r--r--src/camera_system.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/camera_system.h b/src/camera_system.h index 37ff8b4..a2dee93 100644 --- a/src/camera_system.h +++ b/src/camera_system.h
@@ -24,6 +24,13 @@ public:
24 24
25 void unlockCamera() { locked_ = false; } 25 void unlockCamera() { locked_ = false; }
26 26
27 // Pans over to the provided sprite over the provided amount of time.
28 // - length is in milliseconds
29 // Automatically locks the camera.
30 void panToSprite(int targetId, int length);
31
32 bool isPanning() const { return panning_; }
33
27 void tick(double dt) override; 34 void tick(double dt) override;
28 35
29 void destroySprite(int spriteId) override; 36 void destroySprite(int spriteId) override;
@@ -31,12 +38,21 @@ public:
31 void clearSpriteCache() override; 38 void clearSpriteCache() override;
32 39
33private: 40private:
41
42 vec2i calculatePosWithCenter(vec2i center) const;
43
34 Game& game_; 44 Game& game_;
35 45
36 vec2i pos_; 46 vec2i pos_;
37 vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT }; 47 vec2i fov_ { CANVAS_WIDTH, CANVAS_HEIGHT };
38 int followingSprite_ = -1; 48 int followingSprite_ = -1;
39 bool locked_ = true; 49 bool locked_ = true;
50
51 bool panning_ = false;
52 vec2i panStart_;
53 vec2i panEnd_;
54 double panLength_ = 0.0;
55 double panThus_ = 0.0;
40}; 56};
41 57
42#endif /* end of include guard: CAMERA_SYSTEM_H_D52ADAD3 */ 58#endif /* end of include guard: CAMERA_SYSTEM_H_D52ADAD3 */