X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcontroller.hpp;h=f674e23df9a0a9375c14bc56838acf8279881594;hb=e53a0e2e711a7d8bd9b0ddacd1360aa14370643f;hp=63c102f489445a26bf241309ba0153b15de4c7d8;hpb=cb959294a8271969ddfe411471d7f04e82c4788a;p=blank.git diff --git a/src/controller.hpp b/src/controller.hpp index 63c102f..f674e23 100644 --- a/src/controller.hpp +++ b/src/controller.hpp @@ -4,7 +4,6 @@ #include "entity.hpp" #include "geometry.hpp" -#include #include @@ -13,34 +12,45 @@ namespace blank { class FPSController { public: - explicit FPSController(Entity &); + explicit FPSController(Entity &) noexcept; - Ray Aim() const { return entity.Aim(); } + Ray Aim() const noexcept { return entity.Aim(entity.ChunkCoords()); } - // all angles in radians (full circle = 2π) - float Pitch() const { return pitch; } - void Pitch(float p); - void RotatePitch(float delta); - float Yaw() const { return yaw; } - void Yaw(float y); - void RotateYaw(float delta); + const glm::vec3 &Velocity() const noexcept { return velocity; } + void Velocity(const glm::vec3 &vel) noexcept { velocity = vel; } - void HandleKeyboard(const SDL_KeyboardEvent &); - void HandleMouse(const SDL_MouseMotionEvent &); + // all angles in radians (full circle = 2π) + float Pitch() const noexcept { return pitch; } + void Pitch(float p) noexcept; + void RotatePitch(float delta) noexcept; + float Yaw() const noexcept { return yaw; } + void Yaw(float y) noexcept; + void RotateYaw(float delta) noexcept; - void Update(int dt); + void Update(int dt) noexcept; private: Entity &entity; + glm::vec3 velocity; + float pitch; float yaw; - float move_velocity; - float pitch_sensitivity; - float yaw_sensitivity; +}; + + +class RandomWalk { + +public: + explicit RandomWalk(Entity &) noexcept; + + void Update(int dt) noexcept; + +private: + Entity &entity; - bool front, back, left, right, up, down; + int time_left; };