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