hollyhock
Loading...
Searching...
No Matches
input.hpp
Go to the documentation of this file.
1
9#pragma once
10#include <stdint.h>
11
12const uint16_t EVENT_KEY = 0x0017;
13const uint16_t EVENT_ACTBAR_RESIZE = 0x1003;
14const uint16_t EVENT_ACTBAR_SWAP = 0x1004;
15const uint16_t EVENT_ACTBAR_ROTATE = 0x1005;
16const uint16_t EVENT_ACTBAR_ESC = 0x3009;
17const uint16_t EVENT_ACTBAR_SETTINGS = 0x300A;
18const uint16_t EVENT_TOUCH = 0x4000;
19const uint16_t EVENT_TIMER = 0x0005;
20
21const uint32_t KEY_PRESSED = 1;
22const uint32_t KEY_HELD = 0x100;
23const uint32_t KEY_RELEASED = 0x40;
24
25const uint16_t KEYCODE_KEYBOARD = 0x00B3;
26const uint16_t KEYCODE_SHIFT = 0x00A0;
27const uint16_t KEYCODE_BACKSPACE = 0x0097;
28const uint16_t KEYCODE_POWER_CLEAR = 0x0080;
29const uint16_t KEYCODE_UP = 0x0090;
30const uint16_t KEYCODE_DOWN = 0x0091;
31const uint16_t KEYCODE_LEFT = 0x0092;
32const uint16_t KEYCODE_RIGHT = 0x0093;
33const uint16_t KEYCODE_EQUALS = 0x003D;
34const uint16_t KEYCODE_X = 0xEDB8;
35const uint16_t KEYCODE_Y = 0xEDB9;
36const uint16_t KEYCODE_Z = 0xEDBA;
37const uint16_t KEYCODE_POWER = 0x005E;
38const uint16_t KEYCODE_DIVIDE = 0x002F;
39const uint16_t KEYCODE_OPEN_PARENTHESIS = 0x0028;
40const uint16_t KEYCODE_7 = 0x0037;
41const uint16_t KEYCODE_8 = 0x0038;
42const uint16_t KEYCODE_9 = 0x0039;
43const uint16_t KEYCODE_TIMES = 0xEE10;
44const uint16_t KEYCODE_CLOSE_PARENTHESIS = 0x0029;
45const uint16_t KEYCODE_4 = 0x0034;
46const uint16_t KEYCODE_5 = 0x0035;
47const uint16_t KEYCODE_6 = 0x0036;
48const uint16_t KEYCODE_MINUS = 0x002D;
49const uint16_t KEYCODE_COMMA = 0x002C;
50const uint16_t KEYCODE_1 = 0x0031;
51const uint16_t KEYCODE_2 = 0x0032;
52const uint16_t KEYCODE_3 = 0x0033;
53const uint16_t KEYCODE_PLUS = 0x002B;
54const uint16_t KEYCODE_NEGATIVE = 0x001F;
55const uint16_t KEYCODE_0 = 0x0030;
56const uint16_t KEYCODE_DOT = 0x002E;
57const uint16_t KEYCODE_EXP = 0x001D;
58const uint16_t KEYCODE_EXE = 0x0094;
59
60const uint32_t TOUCH_DOWN = 1;
61const uint32_t TOUCH_HOLD_DRAG = 2;
62const uint32_t TOUCH_ACT_BAR = 0x100;
63const uint32_t TOUCH_UP = 0x40;
64
65enum InputScancode : uint16_t {
66 ScancodeKeyboard = (7 << 8) | 5,
67 ScancodeShift = (7 << 8) | 1,
68 ScancodeBackspace = (7 << 8) | 2,
69 ScancodeClear = (1 << 8) | 0,
70 ScancodeUp = (7 << 8) | 4,
71 ScancodeDown = (6 << 8) | 4,
72 ScancodeLeft = (6 << 8) | 3,
73 ScancodeRight = (7 << 8) | 3,
74 ScancodeEquals = (7 << 8) | 6,
75 ScancodeX = (6 << 8) | 6,
76 ScancodeY = (6 << 8) | 5,
77 ScancodeZ = (5 << 8) | 3,
78 ScancodePower = (6 << 8) | 2,
79 ScancodeDivide = (6 << 8) | 1,
80 ScancodeOpenParenthesis = (5 << 8) | 6,
81 Scancode7 = (5 << 8) | 5,
82 Scancode8 = (5 << 8) | 4,
83 Scancode9 = (5 << 8) | 2,
84 ScancodeTimes = (5 << 8) | 1,
85 ScancodeCloseParenthesis = (4 << 8) | 6,
86 Scancode4 = (4 << 8) | 5,
87 Scancode5 = (4 << 8) | 4,
88 Scancode6 = (4 << 8) | 2,
89 ScancodeMinus = (4 << 8) | 1,
90 ScancodeComma = (3 << 8) | 6,
91 Scancode1 = (3 << 8) | 5,
92 Scancode2 = (3 << 8) | 4,
93 Scancode3 = (3 << 8) | 2,
94 ScancodePlus = (3 << 8) | 1,
95 ScancodeNegative = (2 << 8) | 6,
96 Scancode0 = (2 << 8) | 5,
97 ScancodeDot = (2 << 8) | 4,
98 ScancodeEXP = (2 << 8) | 2,
99 ScancodeEXE = (2 << 8) | 1
100};
101
112 uint16_t type;
113 uint16_t zero;
114
128 union {
129 struct {
134 uint32_t direction;
135
139 uint16_t keyCode;
140 } key;
141
142 struct {
147 uint32_t direction;
148
153 int32_t p1_x;
154
159 int32_t p1_y;
160
161 uint16_t adc_x1;
162 uint16_t adc_y1;
163 uint16_t adc_z1;
164 uint16_t adc_z2;
165 uint16_t adc_x2;
166 uint16_t adc_y2;
167
168 uint16_t adc_gh;
169 uint16_t adc_dm;
170 } touch_single;
171
172 struct {
173 uint32_t direction;
174
175 int32_t p1_x;
176 int32_t p1_y;
177 int32_t p1_z;
178
179 int32_t p2_x;
180 int32_t p2_y;
181 int32_t p2_z;
182
183 uint32_t distance;
184
185 uint16_t adc_x1;
186 uint16_t adc_y1;
187 uint16_t adc_z1;
188 uint16_t adc_z2;
189 uint16_t adc_x2;
190 uint16_t adc_y2;
191
192 uint16_t adc_gh;
193 uint16_t adc_dm;
194 } touch_multi;
196};
197
208extern "C"
209int GetInput(struct InputEvent *event, uint32_t unknown1, uint32_t unknown2);
210
217extern "C"
218bool Input_GetKeyState(InputScancode *scancode);
219
225extern "C"
bool Input_GetKeyState(InputScancode *scancode)
int GetInput(struct InputEvent *event, uint32_t unknown1, uint32_t unknown2)
bool Input_IsAnyKeyDown()
Definition input.hpp:106
int32_t p1_x
Definition input.hpp:153
uint16_t keyCode
Definition input.hpp:139
uint16_t type
Definition input.hpp:112
union InputEvent::@1 data
uint32_t direction
Definition input.hpp:134
int32_t p1_y
Definition input.hpp:159