]> git.localhorst.tv Git - blank.git/blobdiff - src/controller.hpp
split entity from controller
[blank.git] / src / controller.hpp
index 8b2cd4eb89d0fcd9761b50ff49553241086566a4..63c102f489445a26bf241309ba0153b15de4c7d8 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef BLANK_CONTROLLER_HPP_
 #define BLANK_CONTROLLER_HPP_
 
+#include "entity.hpp"
+#include "geometry.hpp"
+
+#include <SDL.h>
 #include <glm/glm.hpp>
 
 
@@ -9,31 +13,35 @@ namespace blank {
 class FPSController {
 
 public:
-       FPSController();
-       ~FPSController();
-
-       glm::mat4 Transform() const;
+       explicit FPSController(Entity &);
 
-       void Velocity(glm::vec3 vel) { velocity = 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;
+
 };
 
 }