]> git.localhorst.tv Git - blank.git/blob - src/server/ServerState.hpp
move serverside joining from state to server
[blank.git] / src / server / ServerState.hpp
1 #ifndef BLANK_SERVER_SERVERSTATE_HPP_
2 #define BLANK_SERVER_SERVERSTATE_HPP_
3
4 #include "Server.hpp"
5 #include "../ai/Spawner.hpp"
6 #include "../app/IntervalTimer.hpp"
7 #include "../app/State.hpp"
8 #include "../model/Skeletons.hpp"
9 #include "../world/BlockTypeRegistry.hpp"
10 #include "../world/ChunkLoader.hpp"
11 #include "../world/Generator.hpp"
12 #include "../world/World.hpp"
13
14
15 namespace blank {
16
17 class Config;
18 class HeadlessEnvironment;
19 class WorldSave;
20
21 namespace server {
22
23 class ServerState
24 : public State {
25
26 public:
27         ServerState(
28                 HeadlessEnvironment &,
29                 const Generator::Config &,
30                 const World::Config &,
31                 const WorldSave &,
32                 const Config &
33         );
34         ~ServerState();
35
36         void Handle(const SDL_Event &) override;
37         void Update(int dt) override;
38         void Render(Viewport &) override;
39
40 private:
41         HeadlessEnvironment &env;
42         BlockTypeRegistry block_types;
43         World world;
44         Generator generator;
45         ChunkLoader chunk_loader;
46         Skeletons skeletons;
47         Spawner spawner;
48         Server server;
49         IntervalTimer loop_timer;
50
51 };
52
53 }
54 }
55
56 #endif