2D_Game_Engine
Loading...
Searching...
No Matches
include
input.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
structs.hpp
>
4
5
struct
KeyState
{
6
KeyState
(){
7
current
=
previous
=0;
8
}
9
10
bool
current
;
11
bool
previous
;
12
};
13
14
class
Input
{
15
public
:
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
28
Vec2
GetMousePosition
();
29
private
:
30
std::unordered_map<int,KeyState> m_KeyStates;
31
std::unordered_map<int,KeyState> m_MouseStates;
32
};
Input
Definition
input.hpp:14
Input::UpdateStates
void UpdateStates()
Definition
input.cpp:5
Input::Input
Input()=default
Input::GetMousePosition
Vec2 GetMousePosition()
Definition
input.cpp:17
Input::GetKey
KeyState GetKey(int key)
Definition
input.hpp:20
Input::GetMouseButton
KeyState GetMouseButton(int button)
Definition
input.hpp:24
key
std::string key
Definition
sceneserializer.cpp:422
KeyState
Definition
input.hpp:5
KeyState::previous
bool previous
Definition
input.hpp:11
KeyState::KeyState
KeyState()
Definition
input.hpp:6
KeyState::current
bool current
Definition
input.hpp:10
Vec2
Definition
structs.hpp:3
structs.hpp
Generated by
1.10.0