Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine
1.5.0
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
c
d
f
g
i
l
m
n
o
p
q
r
s
t
v
Functions
a
c
d
f
g
i
l
n
o
p
q
r
s
t
v
Variables
Typedefs
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
b
d
f
h
i
m
n
s
t
v
w
Typedefs
a
b
c
f
g
i
k
o
r
s
t
u
v
Enumerations
Enumerator
Related Functions
Files
File List
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
Keyboard.cpp
1
#include <Gui/Utils/Keyboard.hpp>
2
3
#include <map>
4
5
namespace
Ra
{
6
namespace
Gui {
7
std::map<int, bool> g_keypresses;
8
9
// store the last key pressed, still pressed.
10
int
g_activeKey = -1;
11
12
void
keyPressed(
int
code ) {
13
g_keypresses[code] =
true
;
14
g_activeKey = code;
15
}
16
17
void
keyReleased(
int
code ) {
18
g_keypresses[code] =
false
;
19
if
( code == g_activeKey ) g_activeKey = -1;
20
}
21
22
bool
isKeyPressed(
int
code ) {
23
// Default constructed bool is false, so this should be enough
24
return
g_keypresses[code];
25
}
26
27
int
activeKey() {
28
return
g_activeKey;
29
}
30
31
void
releaseAllKeys() {
32
for
(
auto
& k : g_keypresses ) {
33
k.second =
false
;
34
}
35
g_activeKey = -1;
36
}
37
38
}
// namespace Gui
39
}
// namespace Ra
Ra
Definition:
Cage.cpp:3
src
Gui
Utils
Keyboard.cpp
Generated on Wed Apr 5 2023 15:07:31 for Radium Engine by
1.9.1