Dualie
Loading...
Searching...
No Matches
Input.hpp
1//
2// Created by caleb on 6/16/24.
3//
4
5#ifndef DUALIE_INPUT_HPP
6#define DUALIE_INPUT_HPP
7
8
9#include <citro2d.h>
10#include <array>
11#include <Dualie/System/Vector2.hpp>
12
16namespace dl::Input {
17
18 enum InputType{
19 PRESSED = 0,
20 HELD,
21 RELEASED
22 };
23
24 enum Key{
25 A = BIT(0),
26 B = BIT(1),
27 SELECT = BIT(2),
28 START = BIT(3),
29 DRIGHT = BIT(4),
30 DLEFT = BIT(5),
31 DUP = BIT(6),
32 DDOWN = BIT(7),
33 R = BIT(8),
34 L = BIT(9),
35 X = BIT(10),
36 Y = BIT(11),
37 ZL = BIT(14),
38 ZR = BIT(15),
39 TOUCH = BIT(20),
40 CSTICK_RIGHT = BIT(24),
41 CSTICK_LEFT = BIT(25),
42 CSTICK_UP = BIT(26),
43 CSTICK_DOWN = BIT(27),
44 CPAD_RIGHT = BIT(28),
45 CPAD_LEFT = BIT(29),
46 CPAD_UP = BIT(30),
47 CPAD_DOWN = BIT(31),
48
49 // Generic catch-all directions
54 };
55
56 extern u32 KeyPressedMask;
57 extern u32 KeyHeldMask;
58 extern u32 KeyReleasedMask;
59 extern float SliderValue;
60
61
66
71
77 bool isKeyPressed(Key key);
78
84 bool isKeyHeld(Key key);
85
91 bool isKeyReleased(Key key);
92
93
94 void updateInput();
95
96}
97
98
99#endif //DUALIE_INPUT_HPP
A namespace that encapsulates all input-related functions and enumerations.
Definition Input.hpp:16
bool isKeyPressed(Key key)
Returns whether a certain key was pressed that frame. Note that this does not capture held buttons.
Definition Input.cpp:15
bool isKeyReleased(Key key)
Returns whether a certain key was released that frame.
Definition Input.cpp:23
dl::Vector2f LastTouchPosition
The touch position of the screen. If the screen is not touched, This will be the last valid touch of ...
Definition Input.cpp:13
dl::Vector2f TouchPosition
The touch position of the screen. If the screen is not touched, This will be (0,0)....
Definition Input.cpp:12
bool isKeyHeld(Key key)
Returns whether a certain key was held that frame.
Definition Input.cpp:19
Key
Definition Input.hpp:24
@ SELECT
Select.
Definition Input.hpp:27
@ L
L.
Definition Input.hpp:34
@ Y
Y.
Definition Input.hpp:36
@ ZL
ZL (New 3DS only)
Definition Input.hpp:37
@ R
R.
Definition Input.hpp:33
@ CSTICK_UP
C-Stick Up (New 3DS only)
Definition Input.hpp:42
@ CPAD_LEFT
Circle Pad Left.
Definition Input.hpp:45
@ CSTICK_DOWN
C-Stick Down (New 3DS only)
Definition Input.hpp:43
@ DLEFT
D-Pad Left.
Definition Input.hpp:30
@ DDOWN
D-Pad Down.
Definition Input.hpp:32
@ A
A.
Definition Input.hpp:25
@ UP
D-Pad Up or Circle Pad Up.
Definition Input.hpp:50
@ CPAD_RIGHT
Circle Pad Right.
Definition Input.hpp:44
@ CSTICK_RIGHT
C-Stick Right (New 3DS only)
Definition Input.hpp:40
@ CPAD_UP
Circle Pad Up.
Definition Input.hpp:46
@ TOUCH
Touch (Not actually provided by HID)
Definition Input.hpp:39
@ X
X.
Definition Input.hpp:35
@ ZR
ZR (New 3DS only)
Definition Input.hpp:38
@ CSTICK_LEFT
C-Stick Left (New 3DS only)
Definition Input.hpp:41
@ DOWN
D-Pad Down or Circle Pad Down.
Definition Input.hpp:51
@ RIGHT
D-Pad Right or Circle Pad Right.
Definition Input.hpp:53
@ CPAD_DOWN
Circle Pad Down.
Definition Input.hpp:47
@ B
B.
Definition Input.hpp:26
@ DRIGHT
D-Pad Right.
Definition Input.hpp:29
@ LEFT
D-Pad Left or Circle Pad Left.
Definition Input.hpp:52
@ DUP
D-Pad Up.
Definition Input.hpp:31
@ START
Start.
Definition Input.hpp:28