-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathKeyboard.cpp
More file actions
51 lines (40 loc) · 1.24 KB
/
Keyboard.cpp
File metadata and controls
51 lines (40 loc) · 1.24 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <cpp3ds/Window/Keyboard.hpp>
#include <3ds.h>
namespace cpp3ds {
u32 Keyboard::m_keysHeld = 0;
u32 Keyboard::m_keysPressed = 0;
u32 Keyboard::m_keysReleased = 0;
float Keyboard::m_slider3d = 0;
float Keyboard::m_sliderVolume = 0;
////////////////////////////////////////////////////////////
bool Keyboard::isKeyDown(Key key) {
return (m_keysHeld & static_cast<u32>(key));
}
////////////////////////////////////////////////////////////
bool Keyboard::isKeyPressed(Key key) {
return (m_keysPressed & static_cast<u32>(key));
}
////////////////////////////////////////////////////////////
bool Keyboard::isKeyReleased(Key key) {
return (m_keysReleased & static_cast<u32>(key));
}
////////////////////////////////////////////////////////////
float Keyboard::getSlider3D() {
return m_slider3d;
}
////////////////////////////////////////////////////////////
float Keyboard::getSliderVolume() {
return m_sliderVolume;
}
////////////////////////////////////////////////////////////
void Keyboard::update() {
hidScanInput();
m_keysHeld = hidKeysHeld();
m_keysPressed = hidKeysDown();
m_keysReleased = hidKeysUp();
u8 volume;
HIDUSER_GetSoundVolume(&volume);
m_sliderVolume = static_cast<float>(volume) / 63;
m_slider3d = *(float*)0x1FF81080;
}
}