]> git.localhorst.tv Git - blank.git/blob - src/client/InteractiveState.hpp
fix this whole sky box mess
[blank.git] / src / client / InteractiveState.hpp
1 #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_
2 #define BLANK_CLIENT_INTERACTIVESTATE_HPP_
3
4 #include "ChunkReceiver.hpp"
5 #include "ChunkRequester.hpp"
6 #include "../app/IntervalTimer.hpp"
7 #include "../app/State.hpp"
8 #include "../graphics/SkyBox.hpp"
9 #include "../io/WorldSave.hpp"
10 #include "../model/Skeletons.hpp"
11 #include "../ui/Interface.hpp"
12 #include "../world/BlockTypeRegistry.hpp"
13 #include "../world/ChunkRenderer.hpp"
14 #include "../world/EntityState.hpp"
15 #include "../world/World.hpp"
16
17 #include <list>
18
19
20 namespace blank {
21
22 class Environment;
23
24 namespace client {
25
26 class MasterState;
27
28 class InteractiveState
29 : public State {
30
31 public:
32         explicit InteractiveState(MasterState &, std::uint32_t player_id);
33
34         World &GetWorld() noexcept { return world; }
35         Interface &GetInterface() noexcept { return interface; }
36         ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; }
37         Skeletons &GetSkeletons() noexcept { return skeletons; }
38
39         void OnEnter() override;
40
41         void Handle(const SDL_Event &) override;
42         void Update(int dt) override;
43         void Render(Viewport &) override;
44
45         void PushPlayerUpdate(const Entity &, int dt);
46         void MergePlayerCorrection(std::uint16_t, const EntityState &);
47
48 private:
49         MasterState &master;
50         BlockTypeRegistry block_types;
51         WorldSave save;
52         World world;
53         Interface interface;
54         ChunkRequester chunk_requester;
55         ChunkReceiver chunk_receiver;
56         ChunkRenderer chunk_renderer;
57         Skeletons skeletons;
58         IntervalTimer loop_timer;
59
60         SkyBox sky;
61
62         struct PlayerHistory {
63                 EntityState state;
64                 int delta_t;
65                 std::uint16_t packet;
66                 PlayerHistory(EntityState s, int dt, std::uint16_t p)
67                 : state(s), delta_t(dt), packet(p) { }
68         };
69         std::list<PlayerHistory> player_hist;
70
71 };
72
73 }
74 }
75
76 #endif