Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
InputManager.h
Go to the documentation of this file.
1#pragma once
2#include <array>
3#include <glm/vec2.hpp>
4
5namespace eng
6{
8 {
9 private:
10 InputManager() = default;
11 InputManager(const InputManager&) = delete;
12 InputManager(InputManager&&) = delete;
13 InputManager& operator=(const InputManager&) = delete;
14 InputManager& operator=(InputManager&&) = delete;
15
16 public:
17 void SetKeyPressed(int key, bool pressed);
18 bool IsKeyPressed(int key);
19
20 void SetMouseButtonPressed(int button, bool pressed);
21 bool IsMouseButtonPressed(int button);
22
23 void SetMousePositionOld(const glm::vec2& pos);
24 const glm::vec2& GetMousePositionOld() const;
25
26 void SetMousePositionCurrent(const glm::vec2& pos);
27 const glm::vec2& GetMousePositionCurrent() const;
28
29 void SetMousePositionChanged(bool changed);
30 bool IsMousePositionChanged() const;
31
32 private:
33 std::array<bool, 256> m_keys = { false };
34 std::array<bool, 16> m_mouseKeys = { false };
35 glm::vec2 m_mousePositionOld = glm::vec2(0.0f);
36 glm::vec2 m_mousePositionCurrent = glm::vec2(0.0f);
37 bool m_mousePositionChanged = false;
38
39 friend class Engine;
40 };
41}
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)