Manages keyboard and mouse input. More...
#include <input.hpp>
Classes | |
struct | ButtonInfo |
Stores information about a mouse button's state. More... | |
struct | KeyInfo |
Stores information about a key's state. More... | |
Public Types | |
enum class | Buttons { Mouse_Left , Mouse_Right , Mouse_Middle , Button_Count } |
Enumeration of mouse buttons. More... | |
enum class | Keys { Key_Q , Key_W , Key_E , Key_R , Key_T , Key_Y , Key_U , Key_I , Key_O , Key_P , Key_A , Key_S , Key_D , Key_F , Key_G , Key_H , Key_J , Key_K , Key_L , Key_Z , Key_X , Key_C , Key_V , Key_B , Key_N , Key_M , Key_Space , Key_Escape , Key_Enter , Key_Tab , Key_Backspace , Key_Delete , Key_Left , Key_Right , Key_Up , Key_Down , Key_Control , Key_Alt , Key_Shift , Key_1 , Key_2 , Key_3 , Key_4 , Key_5 , Key_6 , Key_7 , Key_8 , Key_9 , Key_0 , Key_Count } |
Enumeration of keyboard keys. More... | |
Public Member Functions | |
Input (GLFWwindow *window) | |
Constructs an Input object. | |
~Input () | |
Destructor for Input. | |
bool | isKeyPressed (Keys key) |
Checks if a key is currently pressed. | |
bool | isKeyRelease (Keys key) |
Checks if a key was just released. | |
bool | isKeyDown (Keys key) const |
Checks if a key is currently held down. | |
bool | isKeyUp (Keys key) const |
Checks if a key is currently up. | |
bool | isMouseButtonPressed (Buttons button) |
Checks if a mouse button is currently pressed. | |
bool | isMouseButtonRelease (Buttons button) |
Checks if a mouse button was just released. | |
bool | isMouseButtonDown (Buttons button) const |
Checks if a mouse button is currently held down. | |
bool | isMouseButtonUp (Buttons button) const |
Checks if a mouse button is currently up. | |
glm::vec2 | getScrollDelta () |
Retrieves the scroll delta from the last input frame. | |
void | resetScrollTracking () |
Resets scroll tracking data. | |
void | updateKeys () |
Updates the key states for the current frame. | |
glm::vec2 | getMouseDelta () |
Retrieves the mouse movement delta. | |
glm::vec2 | getMousePosition () |
Retrieves the current mouse position. | |
void | resetMouseTracking () |
Resets mouse movement tracking data. | |
|
strong |
|
strong |
Raftel::Input::Input | ( | GLFWwindow * | window | ) |
Constructs an Input object.
window | Pointer to the GLFW window. |
glm::vec2 Raftel::Input::getMouseDelta | ( | ) |
Retrieves the mouse movement delta.
glm::vec2 Raftel::Input::getMousePosition | ( | ) |
Retrieves the current mouse position.
glm::vec2 Raftel::Input::getScrollDelta | ( | ) |
Retrieves the scroll delta from the last input frame.
bool Raftel::Input::isKeyDown | ( | Keys | key | ) | const |
Checks if a key is currently held down.
key | The key to check. |
bool Raftel::Input::isKeyPressed | ( | Keys | key | ) |
Checks if a key is currently pressed.
key | The key to check. |
bool Raftel::Input::isKeyRelease | ( | Keys | key | ) |
Checks if a key was just released.
key | The key to check. |
bool Raftel::Input::isKeyUp | ( | Keys | key | ) | const |
Checks if a key is currently up.
key | The key to check. |
bool Raftel::Input::isMouseButtonDown | ( | Buttons | button | ) | const |
Checks if a mouse button is currently held down.
button | The button to check. |
bool Raftel::Input::isMouseButtonPressed | ( | Buttons | button | ) |
Checks if a mouse button is currently pressed.
button | The button to check. |
bool Raftel::Input::isMouseButtonRelease | ( | Buttons | button | ) |
Checks if a mouse button was just released.
button | The button to check. |
bool Raftel::Input::isMouseButtonUp | ( | Buttons | button | ) | const |
Checks if a mouse button is currently up.
button | The button to check. |