]> git.localhorst.tv Git - blobs.git/blob - src/app/MasterState.hpp
(slightly) better camera handling
[blobs.git] / src / app / MasterState.hpp
1 #ifndef BLOBS_APP_MASTERSTATE_HPP_
2 #define BLOBS_APP_MASTERSTATE_HPP_
3
4 #include "State.hpp"
5
6 #include "Assets.hpp"
7 #include "../graphics/Camera.hpp"
8
9
10 namespace blobs {
11 namespace world {
12         class Body;
13         class Simulation;
14 }
15 namespace app {
16
17 class MasterState
18 : public State {
19
20 public:
21         MasterState(Assets &, world::Simulation &) noexcept;
22         ~MasterState() noexcept;
23
24         MasterState(const MasterState &) = delete;
25         MasterState &operator =(const MasterState &) = delete;
26
27         MasterState(MasterState &&) = delete;
28         MasterState &operator =(MasterState &&) = delete;
29
30 public:
31         graphics::Camera &GetCamera() noexcept { return cam; }
32         const graphics::Camera &GetCamera() const noexcept { return cam; }
33
34 private:
35         void OnResize(int w, int h) override;
36
37         void OnKeyDown(const SDL_KeyboardEvent &) override;
38
39         void OnUpdate(int dt) override;
40         void OnRender(graphics::Viewport &) override;
41
42         void Tick();
43         int FrameMS() const noexcept;
44
45 private:
46         Assets &assets;
47         world::Simulation ∼
48
49         graphics::Camera cam;
50
51         int remain;
52         int thirds;
53         bool paused;
54
55 };
56
57 }
58 }
59
60 #endif