X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcontroller.hpp;h=63c102f489445a26bf241309ba0153b15de4c7d8;hb=cb959294a8271969ddfe411471d7f04e82c4788a;hp=f636bcdccd15bc64339a287044a32cabae9fc45a;hpb=6af76d9e1a6499ebdab405c1d679d24b9e19fded;p=blank.git diff --git a/src/controller.hpp b/src/controller.hpp index f636bcd..63c102f 100644 --- a/src/controller.hpp +++ b/src/controller.hpp @@ -1,6 +1,10 @@ #ifndef BLANK_CONTROLLER_HPP_ #define BLANK_CONTROLLER_HPP_ +#include "entity.hpp" +#include "geometry.hpp" + +#include #include @@ -9,31 +13,35 @@ namespace blank { class FPSController { public: - FPSController(); - - glm::mat4 Transform() const; + explicit FPSController(Entity &); - void Velocity(glm::vec3 vel) { velocity = vel; } - void OrientationVelocity(const glm::vec3 &vel); - void Position(glm::vec3 pos) { position = pos; } - void Move(glm::vec3 delta) { position += delta; } + Ray Aim() const { return entity.Aim(); } // all angles in radians (full circle = 2π) float Pitch() const { return pitch; } - void Pitch(float p) { pitch = p; } - void RotatePitch(float delta) { pitch += delta; } + void Pitch(float p); + void RotatePitch(float delta); float Yaw() const { return yaw; } - void Yaw(float y) { yaw = y; } - void RotateYaw(float delta) { yaw += delta; } + void Yaw(float y); + void RotateYaw(float delta); + + void HandleKeyboard(const SDL_KeyboardEvent &); + void HandleMouse(const SDL_MouseMotionEvent &); void Update(int dt); private: - glm::vec3 velocity; - glm::vec3 position; + Entity &entity; + float pitch; float yaw; + float move_velocity; + float pitch_sensitivity; + float yaw_sensitivity; + + bool front, back, left, right, up, down; + }; }