Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
InputManager.cpp
Go to the documentation of this file.
1#include "input/InputManager.h"
2
3namespace eng
4{
5 void InputManager::SetKeyPressed(int key, bool pressed)
6 {
7 if (key < 0 || key >= static_cast<int>(m_keys.size()))
8 {
9 return;
10 }
11 m_keys[key] = pressed;
12 }
13
15 {
16 if (key < 0 || key >= static_cast<int>(m_keys.size()))
17 {
18 return false;
19 }
20
21 return m_keys[key];
22 }
23
24 void InputManager::SetMouseButtonPressed(int button, bool pressed)
25 {
26 if (button < 0 || button >= static_cast<int>(m_mouseKeys.size()))
27 {
28 return;
29 }
30 m_mouseKeys[button] = pressed;
31 }
32
34 {
35 if (button < 0 || button >= static_cast<int>(m_mouseKeys.size()))
36 {
37 return false;
38 }
39 return m_mouseKeys[button];
40 }
41
42 void InputManager::SetMousePositionOld(const glm::vec2& pos)
43 {
44 m_mousePositionOld = pos;
45 }
46
47 const glm::vec2& InputManager::GetMousePositionOld() const
48 {
49 return m_mousePositionOld;
50 }
51
52 void InputManager::SetMousePositionCurrent(const glm::vec2& pos)
53 {
54 m_mousePositionCurrent = pos;
55 }
56
58 {
59 return m_mousePositionCurrent;
60 }
61
63 {
64 m_mousePositionChanged = changed;
65 }
66
68 {
69 return m_mousePositionChanged;
70 }
71}
bool IsKeyPressed(int key)
void SetMousePositionChanged(bool changed)
const glm::vec2 & GetMousePositionCurrent() const
void SetMousePositionCurrent(const glm::vec2 &pos)
void SetKeyPressed(int key, bool pressed)
bool IsMousePositionChanged() const
void SetMouseButtonPressed(int button, bool pressed)
void SetMousePositionOld(const glm::vec2 &pos)
const glm::vec2 & GetMousePositionOld() const
bool IsMouseButtonPressed(int button)