X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FPlayerController.hpp;h=9cf0bca465eb3550af7c009dfd4049f73b1c2679;hb=ed3bdc028edc0ecb5835d1c0bf18dbc59b342daf;hp=b29795b7313cf9cb5b8d2308e72cfcfa0f03a182;hpb=c1da86ebab41895bf49ed747c75ecf722e8c5586;p=blank.git diff --git a/src/ui/PlayerController.hpp b/src/ui/PlayerController.hpp index b29795b..9cf0bca 100644 --- a/src/ui/PlayerController.hpp +++ b/src/ui/PlayerController.hpp @@ -4,6 +4,7 @@ #include #include "../world/EntityCollision.hpp" +#include "../world/EntityController.hpp" #include "../world/WorldCollision.hpp" @@ -12,11 +13,15 @@ namespace blank { class Player; class World; -class PlayerController { +class PlayerController +: public EntityController { public: PlayerController(World &, Player &); + ~PlayerController(); + World &GetWorld() noexcept { return world; } + const World &GetWorld() const noexcept { return world; } Player &GetPlayer() noexcept { return player; } const Player &GetPlayer() const noexcept { return player; } @@ -29,13 +34,16 @@ public: /// the magnitude (clamped to [0..1]) can be used to attenuate target velocity void SetMovement(const glm::vec3 &) noexcept; const glm::vec3 &GetMovement() const noexcept { return move_dir; } + + glm::vec3 ControlForce(const Entity &, const EntityState &) const override; + /// turn the controlled entity's head by given pitch and yaw deltas void TurnHead(float pitch, float yaw) noexcept; /// get player pitch in radians, normalized to [-PI/2,PI/2] - float GetPitch() const noexcept { return pitch; } + float GetPitch() const noexcept; /// get player yaw in radians, normalized to [-PI,PI] - float GetYaw() const noexcept { return yaw; } + float GetYaw() const noexcept; /// start doing primary action /// what exactly this means depends on the active item @@ -60,8 +68,6 @@ private: World &world; Player &player; glm::vec3 move_dir; - float pitch; - float yaw; bool dirty; WorldCollision aim_world;