Keyboard.hpp
1 #ifndef CPP3DS_KEYBOARD_HPP
2 #define CPP3DS_KEYBOARD_HPP
3 
4 #ifndef EMULATION
5 #include <3ds.h>
6 #endif
7 
8 namespace cpp3ds {
9 
14 class Keyboard {
15 public :
16 
21  enum Key {
22  A = 1,
23  B = 1 << 1,
24  Select = 1 << 2,
25  Start = 1 << 3,
26  DPadRight = 1 << 4,
27  DPadLeft = 1 << 5,
28  DPadUp = 1 << 6,
29  DPadDown = 1 << 7,
30  R = 1 << 8,
31  L = 1 << 9,
32  X = 1 << 10,
33  Y = 1 << 11,
34  ZL = 1 << 14,
35  ZR = 1 << 15,
36  Touchpad = 1 << 20,
37  CStickRight = 1 << 24,
38  CStickLeft = 1 << 25,
39  CStickUp = 1 << 26,
40  CStickDown = 1 << 27,
41  CPadRight = 1 << 28,
42  CPadLeft = 1 << 29,
43  CPadUp = 1 << 30,
44  CPadDown = 1 << 31,
45  Up = DPadUp | CPadUp,
46  Down = DPadDown | CPadDown,
47  Left = DPadLeft | CPadLeft,
48  Right = DPadRight | CPadRight,
49  };
50 
59  static bool isKeyDown(Key key);
60 
69  static bool isKeyPressed(Key key);
70 
79  static bool isKeyReleased(Key key);
80 
81  static float getSlider3D();
82 
83  static float getSliderVolume();
84 
88  static void update();
89 
90 private:
91 
92  static float m_slider3d;
93  static float m_sliderVolume;
94 
95  #ifndef EMULATION
96  static u32 m_keysHeld;
97  static u32 m_keysPressed;
98  static u32 m_keysReleased;
99  #endif
100 };
101 
102 
103 }
104 
105 
106 #endif
107 
108 
The L button.
Definition: Keyboard.hpp:31
The Start button.
Definition: Keyboard.hpp:25
static bool isKeyReleased(Key key)
Check if a key is now being released.
The X button.
Definition: Keyboard.hpp:32
The B button.
Definition: Keyboard.hpp:23
The Y button.
Definition: Keyboard.hpp:33
Either DPadLeft or CPadLeft.
Definition: Keyboard.hpp:47
Either DPadRight or CPadRight.
Definition: Keyboard.hpp:48
static bool isKeyPressed(Key key)
Check if a key is now being pressed.
The Select button.
Definition: Keyboard.hpp:24
Key
Key codes.
Definition: Keyboard.hpp:21
The ZL button (New 3DS only)
Definition: Keyboard.hpp:34
Either DPadDown or CPadDown.
Definition: Keyboard.hpp:46
Either DPadUp or CPadUp.
Definition: Keyboard.hpp:45
The R button.
Definition: Keyboard.hpp:30
Give access to the real-time state of the keyboard.
Definition: Keyboard.hpp:14
The ZR button (New 3DS only)
Definition: Keyboard.hpp:35
static void update()
Update cache values for input.
static bool isKeyDown(Key key)
Check if a key is still being pressed.
The A button.
Definition: Keyboard.hpp:22