X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finterface.hpp;h=9f43f4f6f662b6ba10b71d0706ebf5b202e9887b;hb=83ed3de28841d1eecfca39ff540e804cf6809b32;hp=1f4bb9034baf8028a2bb0dd4386ea6165d40d92b;hpb=c899292fd5dee11bee0fafadf051f4204eb4bf2a;p=blank.git diff --git a/src/interface.hpp b/src/interface.hpp index 1f4bb90..9f43f4f 100644 --- a/src/interface.hpp +++ b/src/interface.hpp @@ -3,9 +3,11 @@ #include "block.hpp" #include "controller.hpp" +#include "geometry.hpp" #include "hud.hpp" #include "model.hpp" #include "shader.hpp" +#include "timer.hpp" #include #include @@ -31,18 +33,20 @@ public: Interface(const Config &, World &); - void Handle(const SDL_KeyboardEvent &); + void HandlePress(const SDL_KeyboardEvent &); + void HandleRelease(const SDL_KeyboardEvent &); void Handle(const SDL_MouseMotionEvent &); - void Handle(const SDL_MouseButtonEvent &); + void HandlePress(const SDL_MouseButtonEvent &); + void HandleRelease(const SDL_MouseButtonEvent &); void Handle(const SDL_MouseWheelEvent &); - void Handle(const SDL_WindowEvent &); + void Handle(const SDL_WindowEvent &) noexcept; void FaceBlock(); void TurnBlock(); void PickBlock(); void PlaceBlock(); - void RemoveBlock(); + void RemoveBlock() noexcept; void PrintBlockInfo(); void PrintChunkInfo(); @@ -55,13 +59,17 @@ public: void Update(int dt); - void Render(DirectionalLighting &); + void Render(DirectionalLighting &) noexcept; + +private: + void CheckAim(); private: World &world; FPSController ctrl; HUD hud; + Ray aim; Chunk *aim_chunk; int aim_block; glm::vec3 aim_normal; @@ -71,6 +79,9 @@ private: Config config; + IntervalTimer place_timer; + IntervalTimer remove_timer; + Block remove; Block selection;