1 #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_
2 #define BLANK_CLIENT_INTERACTIVESTATE_HPP_
4 #include "../app/IntervalTimer.hpp"
5 #include "../app/State.hpp"
6 #include "../io/WorldSave.hpp"
7 #include "../model/Skeletons.hpp"
8 #include "../net/ChunkReceiver.hpp"
9 #include "../ui/Interface.hpp"
10 #include "../world/BlockTypeRegistry.hpp"
11 #include "../world/ChunkRenderer.hpp"
12 #include "../world/EntityState.hpp"
13 #include "../world/World.hpp"
26 class InteractiveState
30 explicit InteractiveState(MasterState &, std::uint32_t player_id);
32 World &GetWorld() noexcept { return world; }
33 Interface &GetInterface() noexcept { return interface; }
34 ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; }
35 Skeletons &GetSkeletons() noexcept { return skeletons; }
37 void OnEnter() override;
39 void Handle(const SDL_Event &) override;
40 void Update(int dt) override;
41 void Render(Viewport &) override;
43 void PushPlayerUpdate(const Entity &, int dt);
44 void MergePlayerCorrection(std::uint16_t, const EntityState &);
48 BlockTypeRegistry block_types;
52 ChunkReceiver chunk_receiver;
53 ChunkRenderer chunk_renderer;
55 IntervalTimer loop_timer;
57 struct PlayerHistory {
61 PlayerHistory(EntityState s, int dt, std::uint16_t p)
62 : state(s), delta_t(dt), packet(p) { }
64 std::list<PlayerHistory> player_hist;