summaryrefslogtreecommitdiff
path: root/src/keyGet.cpp
blob: 005aa51557795ee16dabcf58f64ace6969b922b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "FLD.hpp"

FLD::InputState
FLD::keyGet(SDL_Scancode sc) const
{
	return keystates[sc];
}

bool
FLD::keyDown(SDL_Scancode sc) const
{
	const auto state = keyGet(sc);
	return (state == InputState::Down || state == InputState::Press);
}

bool
FLD::keyUp(SDL_Scancode sc) const
{
	return !keyDown(sc);
}

bool
FLD::keyPressed(SDL_Scancode sc) const
{
	return (keyGet(sc) == InputState::Press);
}

bool
FLD::keyReleased(SDL_Scancode sc) const
{
	return (keyGet(sc) == InputState::Release);
}