]> git.localhorst.tv Git - blank.git/blob - src/standalone/MasterState.hpp
better handling of focus and input
[blank.git] / src / standalone / MasterState.hpp
1 #ifndef BLANK_STANDALONE_MASTERSTATE_HPP_
2 #define BLANK_STANDALONE_MASTERSTATE_HPP_
3
4 #include "../app/State.hpp"
5 #include "../ui/ClientController.hpp"
6
7 #include "PreloadState.hpp"
8 #include "UnloadState.hpp"
9 #include "../ai/Spawner.hpp"
10 #include "../app/ChatState.hpp"
11 #include "../audio/SoundBank.hpp"
12 #include "../graphics/SkyBox.hpp"
13 #include "../shared/WorldResources.hpp"
14 #include "../ui/DirectInput.hpp"
15 #include "../ui/HUD.hpp"
16 #include "../ui/InteractiveManipulator.hpp"
17 #include "../ui/Interface.hpp"
18 #include "../world/ChunkIndex.hpp"
19 #include "../world/ChunkLoader.hpp"
20 #include "../world/ChunkRenderer.hpp"
21 #include "../world/Generator.hpp"
22 #include "../world/Player.hpp"
23 #include "../world/World.hpp"
24
25
26 namespace blank {
27
28 class Config;
29 class Environment;
30
31 namespace standalone {
32
33 class MasterState
34 : public State
35 , public ClientController
36 , public ChatState::Responder {
37
38 public:
39         MasterState(
40                 Environment &,
41                 Config &,
42                 const Generator::Config &,
43                 const World::Config &,
44                 const WorldSave &
45         );
46         ~MasterState();
47
48         void OnResume() override;
49         void OnPause() override;
50
51         void OnFocus() override;
52         void OnBlur() override;
53
54         void Handle(const SDL_Event &) override;
55         void Update(int dt) override;
56         void Render(Viewport &) override;
57
58         World &GetWorld() noexcept { return world; }
59         Interface &GetInterface() noexcept { return interface; }
60
61         void SetAudio(bool) override;
62         void SetVideo(bool) override;
63         void SetHUD(bool) override;
64         void SetDebug(bool) override;
65         void Exit() override;
66
67         void OnLineSubmit(const std::string &) override;
68
69 private:
70         Config &config;
71         Environment &env;
72         WorldResources res;
73         SoundBank sounds;
74         const WorldSave &save;
75         World world;
76         ChunkIndex &spawn_index;
77         Player &player;
78         bool spawn_player;
79         HUD hud;
80         InteractiveManipulator manip;
81         DirectInput input;
82         Interface interface;
83         Generator generator;
84         ChunkLoader chunk_loader;
85         ChunkRenderer chunk_renderer;
86         Spawner spawner;
87
88         SkyBox sky;
89
90         PreloadState preload;
91         UnloadState unload;
92         ChatState chat;
93
94 };
95
96 }
97 }
98
99 #endif