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