#pragma once #include #include #include "KeyObserver.h" struct KeyState { bool IsPressed; bool WasPressed; bool WasReleased; }; class InputSystem { private: GLFWwindow* _window; std::map _keyCodeDictionaryObserver; public: InputSystem() { _window = nullptr; } void ObserveKey(int key); void Update(); void SetWindow(GLFWwindow* window); bool IsLeftMouseDown() const; bool IsRightMouseDown() const; void GetMousePos(glm::vec2& position) const; void GetPickingRay(const glm::mat4& tansform, glm::vec3& startingPoint, glm::vec3& direction) const; bool IsKeyPressed(int key) { return _keyCodeDictionaryObserver[key].IsPressed; } bool WasKeyPressed(int key) { return _keyCodeDictionaryObserver[key].WasPressed; } bool WasKeyReleased(int key) { return _keyCodeDictionaryObserver[key].WasReleased; } };