1 #ifndef BLANK_CLIENT_CLIENTSTATE_HPP_
2 #define BLANK_CLIENT_CLIENTSTATE_HPP_
4 #include "../app/State.hpp"
5 #include "../net/ConnectionHandler.hpp"
8 #include "InitialState.hpp"
9 #include "InteractiveState.hpp"
10 #include "../app/Config.hpp"
22 class InteractiveState;
26 , public ConnectionHandler {
35 Client &GetClient() noexcept { return client; }
36 Environment &GetEnv() noexcept { return env; }
38 Config &GetConfig() noexcept { return config; }
39 const Config &GetConfig() const noexcept { return config; }
41 World::Config &GetWorldConf() noexcept { return world_conf; }
42 const World::Config &GetWorldConf() const noexcept { return world_conf; }
46 void OnEnter() override;
48 void Handle(const SDL_Event &) override;
49 void Update(int dt) override;
50 void Render(Viewport &) override;
52 void OnPacketLost(std::uint16_t) override;
53 void OnTimeout() override;
55 void On(const Packet::Join &) override;
56 void On(const Packet::Part &) override;
57 void On(const Packet::SpawnEntity &) override;
58 void On(const Packet::DespawnEntity &) override;
59 void On(const Packet::EntityUpdate &) override;
60 void On(const Packet::PlayerCorrection &) override;
61 void On(const Packet::ChunkBegin &) override;
62 void On(const Packet::ChunkData &) override;
63 void On(const Packet::BlockUpdate &) override;
64 void On(const Packet::Message &) override;
69 World::Config world_conf;
70 std::unique_ptr<InteractiveState> state;
73 InitialState init_state;