Dualie
Loading...
Searching...
No Matches
include
Dualie
System
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
16
namespace
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
50
UP
=
DUP
|
CPAD_UP
,
51
DOWN
=
DDOWN
|
CPAD_DOWN
,
52
LEFT
=
DLEFT
|
CPAD_LEFT
,
53
RIGHT
=
DRIGHT
|
CPAD_RIGHT
,
54
};
55
56
extern
u32 KeyPressedMask;
57
extern
u32 KeyHeldMask;
58
extern
u32 KeyReleasedMask;
59
extern
float
SliderValue;
60
61
65
extern
dl::Vector2f
TouchPosition
;
66
70
extern
dl::Vector2f
LastTouchPosition
;
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
dl::Vector2< float >
dl::Input
A namespace that encapsulates all input-related functions and enumerations.
Definition
Input.hpp:16
dl::Input::isKeyPressed
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
dl::Input::isKeyReleased
bool isKeyReleased(Key key)
Returns whether a certain key was released that frame.
Definition
Input.cpp:23
dl::Input::LastTouchPosition
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::Input::TouchPosition
dl::Vector2f TouchPosition
The touch position of the screen. If the screen is not touched, This will be (0,0)....
Definition
Input.cpp:12
dl::Input::isKeyHeld
bool isKeyHeld(Key key)
Returns whether a certain key was held that frame.
Definition
Input.cpp:19
dl::Input::Key
Key
Definition
Input.hpp:24
dl::Input::SELECT
@ SELECT
Select.
Definition
Input.hpp:27
dl::Input::L
@ L
L.
Definition
Input.hpp:34
dl::Input::Y
@ Y
Y.
Definition
Input.hpp:36
dl::Input::ZL
@ ZL
ZL (New 3DS only)
Definition
Input.hpp:37
dl::Input::R
@ R
R.
Definition
Input.hpp:33
dl::Input::CSTICK_UP
@ CSTICK_UP
C-Stick Up (New 3DS only)
Definition
Input.hpp:42
dl::Input::CPAD_LEFT
@ CPAD_LEFT
Circle Pad Left.
Definition
Input.hpp:45
dl::Input::CSTICK_DOWN
@ CSTICK_DOWN
C-Stick Down (New 3DS only)
Definition
Input.hpp:43
dl::Input::DLEFT
@ DLEFT
D-Pad Left.
Definition
Input.hpp:30
dl::Input::DDOWN
@ DDOWN
D-Pad Down.
Definition
Input.hpp:32
dl::Input::A
@ A
A.
Definition
Input.hpp:25
dl::Input::UP
@ UP
D-Pad Up or Circle Pad Up.
Definition
Input.hpp:50
dl::Input::CPAD_RIGHT
@ CPAD_RIGHT
Circle Pad Right.
Definition
Input.hpp:44
dl::Input::CSTICK_RIGHT
@ CSTICK_RIGHT
C-Stick Right (New 3DS only)
Definition
Input.hpp:40
dl::Input::CPAD_UP
@ CPAD_UP
Circle Pad Up.
Definition
Input.hpp:46
dl::Input::TOUCH
@ TOUCH
Touch (Not actually provided by HID)
Definition
Input.hpp:39
dl::Input::X
@ X
X.
Definition
Input.hpp:35
dl::Input::ZR
@ ZR
ZR (New 3DS only)
Definition
Input.hpp:38
dl::Input::CSTICK_LEFT
@ CSTICK_LEFT
C-Stick Left (New 3DS only)
Definition
Input.hpp:41
dl::Input::DOWN
@ DOWN
D-Pad Down or Circle Pad Down.
Definition
Input.hpp:51
dl::Input::RIGHT
@ RIGHT
D-Pad Right or Circle Pad Right.
Definition
Input.hpp:53
dl::Input::CPAD_DOWN
@ CPAD_DOWN
Circle Pad Down.
Definition
Input.hpp:47
dl::Input::B
@ B
B.
Definition
Input.hpp:26
dl::Input::DRIGHT
@ DRIGHT
D-Pad Right.
Definition
Input.hpp:29
dl::Input::LEFT
@ LEFT
D-Pad Left or Circle Pad Left.
Definition
Input.hpp:52
dl::Input::DUP
@ DUP
D-Pad Up.
Definition
Input.hpp:31
dl::Input::START
@ START
Start.
Definition
Input.hpp:28
Generated by
1.12.0