]> git.localhorst.tv Git - blank.git/blob - src/client/InteractiveState.hpp
exchange block updates with clients
[blank.git] / src / client / InteractiveState.hpp
1 #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_
2 #define BLANK_CLIENT_INTERACTIVESTATE_HPP_
3
4 #include "../app/State.hpp"
5 #include "../ui/ClientController.hpp"
6
7 #include "ChunkReceiver.hpp"
8 #include "ChunkRequester.hpp"
9 #include "NetworkedInput.hpp"
10 #include "../app/IntervalTimer.hpp"
11 #include "../graphics/SkyBox.hpp"
12 #include "../io/WorldSave.hpp"
13 #include "../model/Skeletons.hpp"
14 #include "../net/Packet.hpp"
15 #include "../ui/HUD.hpp"
16 #include "../ui/InteractiveManipulator.hpp"
17 #include "../ui/Interface.hpp"
18 #include "../world/BlockTypeRegistry.hpp"
19 #include "../world/ChunkRenderer.hpp"
20 #include "../world/EntityState.hpp"
21 #include "../world/Player.hpp"
22 #include "../world/World.hpp"
23
24
25 namespace blank {
26
27 class Environment;
28
29 namespace client {
30
31 class MasterState;
32
33 class InteractiveState
34 : public State
35 , public ClientController {
36
37 public:
38         explicit InteractiveState(MasterState &, std::uint32_t player_id);
39
40         World &GetWorld() noexcept { return world; }
41         Player &GetPlayer() noexcept { return player; }
42         ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; }
43         Skeletons &GetSkeletons() noexcept { return skeletons; }
44
45         void OnEnter() override;
46
47         void Handle(const SDL_Event &) override;
48         void Update(int dt) override;
49         void Render(Viewport &) override;
50
51         void MergePlayerCorrection(std::uint16_t, const EntityState &);
52         void Handle(const Packet::BlockUpdate &);
53
54         void SetAudio(bool) override;
55         void SetVideo(bool) override;
56         void SetHUD(bool) override;
57         void SetDebug(bool) override;
58         void Exit() override;
59
60 private:
61         MasterState &master;
62         BlockTypeRegistry block_types;
63         WorldSave save;
64         World world;
65         Player &player;
66         HUD hud;
67         InteractiveManipulator manip;
68         NetworkedInput input;
69         Interface interface;
70         ChunkRequester chunk_requester;
71         ChunkReceiver chunk_receiver;
72         ChunkRenderer chunk_renderer;
73         Skeletons skeletons;
74         IntervalTimer loop_timer;
75
76         SkyBox sky;
77
78 };
79
80 }
81 }
82
83 #endif