1 #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_
2 #define BLANK_CLIENT_INTERACTIVESTATE_HPP_
4 #include "ChunkReceiver.hpp"
5 #include "ChunkRequester.hpp"
6 #include "../app/IntervalTimer.hpp"
7 #include "../app/State.hpp"
8 #include "../io/WorldSave.hpp"
9 #include "../model/Skeletons.hpp"
10 #include "../ui/Interface.hpp"
11 #include "../world/BlockTypeRegistry.hpp"
12 #include "../world/ChunkRenderer.hpp"
13 #include "../world/EntityState.hpp"
14 #include "../world/World.hpp"
27 class InteractiveState
31 explicit InteractiveState(MasterState &, std::uint32_t player_id);
33 World &GetWorld() noexcept { return world; }
34 Interface &GetInterface() noexcept { return interface; }
35 ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; }
36 Skeletons &GetSkeletons() noexcept { return skeletons; }
38 void OnEnter() override;
40 void Handle(const SDL_Event &) override;
41 void Update(int dt) override;
42 void Render(Viewport &) override;
44 void PushPlayerUpdate(const Entity &, int dt);
45 void MergePlayerCorrection(std::uint16_t, const EntityState &);
49 BlockTypeRegistry block_types;
53 ChunkRequester chunk_requester;
54 ChunkReceiver chunk_receiver;
55 ChunkRenderer chunk_renderer;
57 IntervalTimer loop_timer;
59 struct PlayerHistory {
63 PlayerHistory(EntityState s, int dt, std::uint16_t p)
64 : state(s), delta_t(dt), packet(p) { }
66 std::list<PlayerHistory> player_hist;