]> git.localhorst.tv Git - blank.git/blob - src/controller.hpp
split entity from controller
[blank.git] / src / controller.hpp
1 #ifndef BLANK_CONTROLLER_HPP_
2 #define BLANK_CONTROLLER_HPP_
3
4 #include "entity.hpp"
5 #include "geometry.hpp"
6
7 #include <SDL.h>
8 #include <glm/glm.hpp>
9
10
11 namespace blank {
12
13 class FPSController {
14
15 public:
16         explicit FPSController(Entity &);
17
18         Ray Aim() const { return entity.Aim(); }
19
20         // all angles in radians (full circle = 2π)
21         float Pitch() const { return pitch; }
22         void Pitch(float p);
23         void RotatePitch(float delta);
24         float Yaw() const { return yaw; }
25         void Yaw(float y);
26         void RotateYaw(float delta);
27
28         void HandleKeyboard(const SDL_KeyboardEvent &);
29         void HandleMouse(const SDL_MouseMotionEvent &);
30
31         void Update(int dt);
32
33 private:
34         Entity &entity;
35
36         float pitch;
37         float yaw;
38
39         float move_velocity;
40         float pitch_sensitivity;
41         float yaw_sensitivity;
42
43         bool front, back, left, right, up, down;
44
45 };
46
47 }
48
49 #endif