2D_Game_Engine
Loading...
Searching...
No Matches
input.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <structs.hpp>
4
5struct KeyState{
9
10 bool current;
12};
13
14class Input{
15public:
16 Input()=default;
17
18 void UpdateStates();
19
20 inline KeyState GetKey(int key){
21 return m_KeyStates[key];
22 }
23
24 inline KeyState GetMouseButton(int button){
25 return m_MouseStates[button];
26 }
27
29private:
30 std::unordered_map<int,KeyState> m_KeyStates;
31 std::unordered_map<int,KeyState> m_MouseStates;
32};
void UpdateStates()
Definition input.cpp:5
Input()=default
Vec2 GetMousePosition()
Definition input.cpp:17
KeyState GetKey(int key)
Definition input.hpp:20
KeyState GetMouseButton(int button)
Definition input.hpp:24
std::string key
bool previous
Definition input.hpp:11
KeyState()
Definition input.hpp:6
bool current
Definition input.hpp:10