X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2FNetworkedInput.hpp;fp=src%2Fclient%2FNetworkedInput.hpp;h=462b6a721155f0a3c7f672f87c79f0113d2c8555;hb=c1da86ebab41895bf49ed747c75ecf722e8c5586;hp=0000000000000000000000000000000000000000;hpb=ccd6e7001572808400b9cb9bc91f9bedcf28a1ad;p=blank.git diff --git a/src/client/NetworkedInput.hpp b/src/client/NetworkedInput.hpp new file mode 100644 index 0000000..462b6a7 --- /dev/null +++ b/src/client/NetworkedInput.hpp @@ -0,0 +1,53 @@ +#ifndef BLANK_CLIENT_NETWORKEDINPUT_HPP_ +#define BLANK_CLIENT_NETWORKEDINPUT_HPP_ + +#include "../ui/PlayerController.hpp" + +#include "../world/EntityState.hpp" + +#include +#include + + +namespace blank { +namespace client { + +class Client; + +class NetworkedInput +: public PlayerController { + +public: + explicit NetworkedInput(World &, Player &, Client &); + + void Update(int dt); + void PushPlayerUpdate(int dt); + void MergePlayerCorrection(std::uint16_t, const EntityState &); + + void StartPrimaryAction() override; + void StopPrimaryAction() override; + void StartSecondaryAction() override; + void StopSecondaryAction() override; + void StartTertiaryAction() override; + void StopTertiaryAction() override; + +private: + Client &client; + + 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; + + std::uint8_t actions; + +}; + +} +} + +#endif