]> git.localhorst.tv Git - blobs.git/blob - src/app/MasterState.hpp
24a29e696463e960918708f1be4151e4429b2de7
[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         void OnMouseDown(const SDL_MouseButtonEvent &) override;
43         void OnMouseUp(const SDL_MouseButtonEvent &) override;
44         void OnMouseMotion(const SDL_MouseMotionEvent &) override;
45         void OnMouseWheel(const SDL_MouseWheelEvent &) override;
46
47         void OnUpdate(int dt) override;
48         void OnRender(graphics::Viewport &) override;
49
50         void Tick();
51         int FrameMS() const noexcept;
52
53 private:
54         Assets &assets;
55         world::Simulation ∼
56
57         graphics::Camera cam;
58         double cam_dist;
59         double cam_tgt_dist;
60         glm::dvec3 cam_orient;
61         bool cam_dragging;
62
63         ui::CreaturePanel cp;
64
65         int remain;
66         int thirds;
67         bool paused;
68
69 };
70
71 }
72 }
73
74 #endif