]> git.localhorst.tv Git - blank.git/blob - src/standalone/MasterState.hpp
173c07cdd1e8208dd5939efb9b5842311a449650
[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 Handle(const SDL_Event &) override;
52         void Update(int dt) override;
53         void Render(Viewport &) override;
54
55         World &GetWorld() noexcept { return world; }
56         Interface &GetInterface() noexcept { return interface; }
57
58         void SetAudio(bool) override;
59         void SetVideo(bool) override;
60         void SetHUD(bool) override;
61         void SetDebug(bool) override;
62         void Exit() override;
63
64         void OnLineSubmit(const std::string &) override;
65
66 private:
67         Config &config;
68         Environment &env;
69         WorldResources res;
70         SoundBank sounds;
71         const WorldSave &save;
72         World world;
73         ChunkIndex &spawn_index;
74         Player &player;
75         bool spawn_player;
76         HUD hud;
77         InteractiveManipulator manip;
78         DirectInput input;
79         Interface interface;
80         Generator generator;
81         ChunkLoader chunk_loader;
82         ChunkRenderer chunk_renderer;
83         Spawner spawner;
84
85         SkyBox sky;
86
87         PreloadState preload;
88         UnloadState unload;
89         ChatState chat;
90
91 };
92
93 }
94 }
95
96 #endif