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