hollyhock
input.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 #include <stdint.h>
11 
12 const uint16_t EVENT_KEY = 0x0017;
13 const uint16_t EVENT_ACTBAR_RESIZE = 0x1003;
14 const uint16_t EVENT_ACTBAR_SWAP = 0x1004;
15 const uint16_t EVENT_ACTBAR_ROTATE = 0x1005;
16 const uint16_t EVENT_ACTBAR_ESC = 0x3009;
17 const uint16_t EVENT_ACTBAR_SETTINGS = 0x300A;
18 const uint16_t EVENT_TOUCH = 0x4000;
19 const uint16_t EVENT_TIMER = 0x0005;
20 
21 const uint32_t KEY_PRESSED = 1;
22 const uint32_t KEY_HELD = 0x100;
23 const uint32_t KEY_RELEASED = 0x40;
24 
25 const uint16_t KEYCODE_KEYBOARD = 0x00B3;
26 const uint16_t KEYCODE_SHIFT = 0x00A0;
27 const uint16_t KEYCODE_BACKSPACE = 0x0097;
28 const uint16_t KEYCODE_POWER_CLEAR = 0x0080;
29 const uint16_t KEYCODE_UP = 0x0090;
30 const uint16_t KEYCODE_DOWN = 0x0091;
31 const uint16_t KEYCODE_LEFT = 0x0092;
32 const uint16_t KEYCODE_RIGHT = 0x0093;
33 const uint16_t KEYCODE_EQUALS = 0x003D;
34 const uint16_t KEYCODE_X = 0xEDB8;
35 const uint16_t KEYCODE_Y = 0xEDB9;
36 const uint16_t KEYCODE_Z = 0xEDBA;
37 const uint16_t KEYCODE_POWER = 0x005E;
38 const uint16_t KEYCODE_DIVIDE = 0x002F;
39 const uint16_t KEYCODE_OPEN_PARENTHESIS = 0x0028;
40 const uint16_t KEYCODE_7 = 0x0037;
41 const uint16_t KEYCODE_8 = 0x0038;
42 const uint16_t KEYCODE_9 = 0x0039;
43 const uint16_t KEYCODE_TIMES = 0xEE10;
44 const uint16_t KEYCODE_CLOSE_PARENTHESIS = 0x0029;
45 const uint16_t KEYCODE_4 = 0x0034;
46 const uint16_t KEYCODE_5 = 0x0035;
47 const uint16_t KEYCODE_6 = 0x0036;
48 const uint16_t KEYCODE_MINUS = 0x002D;
49 const uint16_t KEYCODE_COMMA = 0x002C;
50 const uint16_t KEYCODE_1 = 0x0031;
51 const uint16_t KEYCODE_2 = 0x0032;
52 const uint16_t KEYCODE_3 = 0x0033;
53 const uint16_t KEYCODE_PLUS = 0x002B;
54 const uint16_t KEYCODE_NEGATIVE = 0x001F;
55 const uint16_t KEYCODE_0 = 0x0030;
56 const uint16_t KEYCODE_DOT = 0x002E;
57 const uint16_t KEYCODE_EXP = 0x001D;
58 const uint16_t KEYCODE_EXE = 0x0094;
59 
60 const uint32_t TOUCH_DOWN = 1;
61 const uint32_t TOUCH_HOLD_DRAG = 2;
62 const uint32_t TOUCH_ACT_BAR = 0x100;
63 const uint32_t TOUCH_UP = 0x40;
64 
65 enum 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 
106 struct InputEvent {
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;
195  } data;
196 };
197 
208 extern "C"
209 int GetInput(struct InputEvent *event, uint32_t unknown1, uint32_t unknown2);
210 
217 extern "C"
218 bool Input_GetKeyState(InputScancode *scancode);
219 
225 extern "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