X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2FInteractiveState.hpp;h=8e7064eacf0a1e2be1f98bf309abe463f26d7043;hb=d5ef462f3bd70a9717c1309466ce8d90b038c5cd;hp=5a43cd89e63b18757d4675bb7a001e0775db7884;hpb=2e3774eb3f2d5d23a08731175b168566457e2192;p=blank.git diff --git a/src/client/InteractiveState.hpp b/src/client/InteractiveState.hpp index 5a43cd8..8e7064e 100644 --- a/src/client/InteractiveState.hpp +++ b/src/client/InteractiveState.hpp @@ -1,21 +1,25 @@ #ifndef BLANK_CLIENT_INTERACTIVESTATE_HPP_ #define BLANK_CLIENT_INTERACTIVESTATE_HPP_ +#include "../app/State.hpp" +#include "../ui/ClientController.hpp" + #include "ChunkReceiver.hpp" -#include "ChunkRequester.hpp" +#include "NetworkedInput.hpp" #include "../app/IntervalTimer.hpp" -#include "../app/State.hpp" #include "../graphics/SkyBox.hpp" #include "../io/WorldSave.hpp" #include "../model/Skeletons.hpp" +#include "../net/Packet.hpp" +#include "../ui/HUD.hpp" +#include "../ui/InteractiveManipulator.hpp" #include "../ui/Interface.hpp" #include "../world/BlockTypeRegistry.hpp" #include "../world/ChunkRenderer.hpp" #include "../world/EntityState.hpp" +#include "../world/Player.hpp" #include "../world/World.hpp" -#include - namespace blank { @@ -26,13 +30,14 @@ namespace client { class MasterState; class InteractiveState -: public State { +: public State +, public ClientController { public: explicit InteractiveState(MasterState &, std::uint32_t player_id); World &GetWorld() noexcept { return world; } - Interface &GetInterface() noexcept { return interface; } + Player &GetPlayer() noexcept { return player; } ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; } Skeletons &GetSkeletons() noexcept { return skeletons; } @@ -42,16 +47,25 @@ public: void Update(int dt) override; void Render(Viewport &) override; - void PushPlayerUpdate(const Entity &, int dt); void MergePlayerCorrection(std::uint16_t, const EntityState &); + void Handle(const Packet::BlockUpdate &); + + void SetAudio(bool) override; + void SetVideo(bool) override; + void SetHUD(bool) override; + void SetDebug(bool) override; + void Exit() override; private: MasterState &master; BlockTypeRegistry block_types; WorldSave save; World world; + Player &player; + HUD hud; + InteractiveManipulator manip; + NetworkedInput input; Interface interface; - ChunkRequester chunk_requester; ChunkReceiver chunk_receiver; ChunkRenderer chunk_renderer; Skeletons skeletons; @@ -59,15 +73,6 @@ private: SkyBox sky; - struct PlayerHistory { - EntityState state; - int delta_t; - std::uint16_t packet; - PlayerHistory(EntityState s, int dt, std::uint16_t p) - : state(s), delta_t(dt), packet(p) { } - }; - std::list player_hist; - }; }