|
Monad Engine da02fba2
> Undercity Codex_
|
Stores per-frame keyboard and mouse input state. More...
#include <InputManager.h>
Public Member Functions | |
| InputManager ()=default | |
| InputManager (const InputManager &)=delete | |
| InputManager (InputManager &&)=delete | |
| InputManager & | operator= (const InputManager &)=delete |
| InputManager & | operator= (InputManager &&)=delete |
| void | SetKeyPressed (Key key, bool pressed) |
| Record a key press or release event. | |
| bool | IsKeyPressed (Key key) const |
| Query whether a key is currently held down. | |
| void | SetMouseButtonPressed (MouseButton button, bool pressed) |
| Record a mouse-button press or release event. | |
| bool | IsMouseButtonPressed (MouseButton button) const |
| Query whether a mouse button is currently held down. | |
| void | SetMousePositionOld (const vec2 &pos) |
| Store the cursor position from the previous frame. | |
| const vec2 | GetMousePositionOld () const |
| Retrieve the cursor position from the previous frame. | |
| void | SetMousePositionCurrent (const vec2 &pos) |
| Store the cursor position for the current frame. | |
| void | SetMousePositionChanged (bool changed) |
| bool | IsMousePositionChanged () const |
| const vec2 | GetMousePositionCurrent () const |
| Retrieve the cursor position for the current frame. | |
Friends | |
| class | Engine |
Stores per-frame keyboard and mouse input state.
Owned by the Engine singleton. Game code reads state; only the Engine writes state (it is a friend). Arrays are sized for 512 keys and 16 mouse buttons, matching GLFW's key-code range.
Definition at line 33 of file InputManager.h.
|
default |
|
delete |
|
delete |
| const vec2 mnd::InputManager::GetMousePositionCurrent | ( | ) | const |
Retrieve the cursor position for the current frame.
Subtract GetMousePositionOld() to get a per-frame delta suitable for camera rotation.
Definition at line 82 of file InputManager.cpp.
Referenced by mnd::Engine::Run().
| const vec2 mnd::InputManager::GetMousePositionOld | ( | ) | const |
Retrieve the cursor position from the previous frame.
Definition at line 72 of file InputManager.cpp.
| bool mnd::InputManager::IsKeyPressed | ( | Key | key | ) | const |
Query whether a key is currently held down.
| key | Key code (e.g. Key::W). |
Definition at line 26 of file InputManager.cpp.
References mnd::EditorSwallowsInput(), and LOG_WARN.
| bool mnd::InputManager::IsMouseButtonPressed | ( | MouseButton | button | ) | const |
Query whether a mouse button is currently held down.
| button | Mouse-button code (e.g. MouseButton::Left). |
Definition at line 52 of file InputManager.cpp.
References mnd::EditorSwallowsInput().
| bool mnd::InputManager::IsMousePositionChanged | ( | ) | const |
Definition at line 92 of file InputManager.cpp.
References mnd::EditorSwallowsInput().
|
delete |
|
delete |
| void mnd::InputManager::SetKeyPressed | ( | Key | key, |
| bool | pressed | ||
| ) |
Record a key press or release event.
| key | Key code (out-of-range values are ignored with a warning). |
| pressed | True when pressed, false when released. |
Definition at line 15 of file InputManager.cpp.
References LOG_WARN.
Referenced by mnd::KeyCallback().
| void mnd::InputManager::SetMouseButtonPressed | ( | MouseButton | button, |
| bool | pressed | ||
| ) |
Record a mouse-button press or release event.
| button | Mouse-button code. |
| pressed | True when pressed, false when released. |
Definition at line 42 of file InputManager.cpp.
Referenced by mnd::MouseButtonCallback().
| void mnd::InputManager::SetMousePositionChanged | ( | bool | changed | ) |
Definition at line 87 of file InputManager.cpp.
Referenced by mnd::Engine::Run().
| void mnd::InputManager::SetMousePositionCurrent | ( | const vec2 & | pos | ) |
Store the cursor position for the current frame.
| pos | Screen-space cursor coordinates. |
Definition at line 77 of file InputManager.cpp.
| void mnd::InputManager::SetMousePositionOld | ( | const vec2 & | pos | ) |
Store the cursor position from the previous frame.
| pos | Screen-space cursor coordinates. |
Definition at line 67 of file InputManager.cpp.
Referenced by mnd::CursorPositionCallback(), and mnd::Engine::Run().
|
friend |
Definition at line 110 of file InputManager.h.