1 #include "ServerState.hpp"
3 #include "Environment.hpp"
4 #include "TextureIndex.hpp"
5 #include "../net/io.hpp"
12 ServerState::ServerState(
13 HeadlessEnvironment &env,
14 const Generator::Config &gc,
15 const World::Config &wc,
17 const Server::Config &sc
21 , world(block_types, wc)
23 , chunk_loader(world.Chunks(), generator, ws)
25 , spawner(world, skeletons, gc.seed)
28 TextureIndex tex_index;
29 env.loader.LoadBlockTypes("default", block_types, tex_index);
30 skeletons.LoadHeadless();
34 std::cout << "listening on UDP port " << sc.port << std::endl;
38 void ServerState::Handle(const SDL_Event &event) {
39 if (event.type == SDL_QUIT) {
45 void ServerState::Update(int dt) {
46 push_timer.Update(dt);
50 chunk_loader.Update(dt);
51 if (push_timer.Hit()) {
57 void ServerState::Render(Viewport &viewport) {