]> git.localhorst.tv Git - blank.git/blob - src/standalone/MasterState.hpp
610f13a128665ed615ce41435d436a53562662f4
[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 NextCamera() override;
67         void Exit() override;
68
69         void OnLineSubmit(const std::string &) override;
70
71 private:
72         Config &config;
73         Environment &env;
74         WorldResources res;
75         SoundBank sounds;
76         const WorldSave &save;
77         World world;
78         ChunkIndex &spawn_index;
79         Player &player;
80         bool spawn_player;
81         HUD hud;
82         InteractiveManipulator manip;
83         DirectInput input;
84         Interface interface;
85         Generator generator;
86         ChunkLoader chunk_loader;
87         ChunkRenderer chunk_renderer;
88         Spawner spawner;
89
90         SkyBox sky;
91
92         CLI cli;
93
94         PreloadState preload;
95         UnloadState unload;
96         ChatState chat;
97
98 };
99
100 }
101 }
102
103 #endif