]> git.localhorst.tv Git - blank.git/blob - src/app/WorldState.hpp
split composite model in template and instance
[blank.git] / src / app / WorldState.hpp
1 #ifndef BLANK_APP_WORLDSTATE_HPP_
2 #define BLANK_APP_WORLDSTATE_HPP_
3
4 #include "PreloadState.hpp"
5 #include "State.hpp"
6 #include "UnloadState.hpp"
7 #include "../ai/Spawner.hpp"
8 #include "../ui/Interface.hpp"
9 #include "../world/BlockTypeRegistry.hpp"
10 #include "../world/ChunkRenderer.hpp"
11 #include "../world/World.hpp"
12
13
14 namespace blank {
15
16 class Environment;
17
18 class WorldState
19 : public State {
20
21 public:
22         WorldState(
23                 Environment &,
24                 const Interface::Config &,
25                 const World::Config &,
26                 const WorldSave &
27         );
28
29         void OnEnter() override;
30
31         void Handle(const SDL_Event &) override;
32         void Update(int dt) override;
33         void Render(Viewport &) override;
34
35         World &GetWorld() noexcept { return world; }
36         Interface &GetInterface() noexcept { return interface; }
37
38 private:
39         Environment &env;
40         BlockTypeRegistry block_types;
41         World world;
42         ChunkRenderer chunk_renderer;
43         Spawner spawner;
44         Interface interface;
45
46         PreloadState preload;
47         UnloadState unload;
48
49 };
50
51 }
52
53 #endif