source: Daodan/src/Oni/Input.h@ 1164

Last change on this file since 1164 was 1163, checked in by rossy, 3 years ago

Daodan: Add new local input system based on Raw Input

File size: 3.1 KB
Line 
1#ifndef ONI_H
2#error Do not include this file directly, include Oni/Oni.h instead!
3#endif
4
5#ifndef ONI_INPUT_H
6#define ONI_INPUT_H
7
8enum {
9 LIcKey_MouseButton1 = 0x01,
10 LIcKey_MouseButton2 = 0x02,
11 LIcKey_MouseButton3 = 0x03,
12 LIcKey_MouseButton4 = 0x04,
13 LIcKey_MouseXAxis = 0x05,
14 LIcKey_MouseYAxis = 0x06,
15 LIcKey_MouseZAxis = 0x07,
16 LIcKey_Backspace = 0x08,
17 LIcKey_Tab = 0x09,
18 LIcKey_Enter = 0x0d,
19 LIcKey_Escape = 0x1b, /* Not in LIgInputNames */
20 /* Printable ASCII characters are in here */
21 LIcKey_FKey1 = 0x81,
22 LIcKey_FKey2 = 0x82,
23 LIcKey_FKey3 = 0x83,
24 LIcKey_FKey4 = 0x84,
25 LIcKey_FKey5 = 0x85,
26 LIcKey_FKey6 = 0x86,
27 LIcKey_FKey7 = 0x87,
28 LIcKey_FKey8 = 0x88,
29 LIcKey_FKey9 = 0x89,
30 LIcKey_FKey10 = 0x8a,
31 LIcKey_FKey11 = 0x8b,
32 LIcKey_FKey12 = 0x8c,
33 LIcKey_PrintScreen = 0x8d,
34 LIcKey_FKey13 = 0x8d, /* Alias of LIcKey_PrintScreen */
35 LIcKey_ScrollLock = 0x8e,
36 LIcKey_FKey14 = 0x8e, /* Alias of LIcKey_ScrollLock */
37 LIcKey_Pause = 0x8f,
38 LIcKey_FKey15 = 0x8f, /* Alias of LIcKey_Pause */
39 LIcKey_CapsLock = 0x90,
40 LIcKey_LeftShift = 0x91,
41 LIcKey_RightShift = 0x92,
42 LIcKey_LeftControl = 0x93,
43 /* LIgInputNames has both "leftwindows" and "leftoption" for key 0x94, but
44 nothing is mapped to 0x94 in the DirectInput and Win32 keymaps. In both
45 of them, the left Windows key is mapped to 0xc7 instead. */
46 LIcKey_LeftAlt = 0x95,
47 LIcKey_RightAlt = 0x96,
48 /* LIgInputNames has both "rightoption" and "rightwindows" for key 0x97, but
49 nothing is mapped to 0x97 in the DirectInput and Win32 keymaps. In both
50 of them, the right Windows key is mapped to 0xc9 instead. */
51 LIcKey_Apps = 0x98,
52 LIcKey_RightControl = 0x99,
53 LIcKey_Insert = 0xaa,
54 LIcKey_Home = 0xab,
55 LIcKey_PageUp = 0xac,
56 LIcKey_Delete = 0xad,
57 LIcKey_End = 0xae,
58 LIcKey_PageDown = 0xaf,
59 LIcKey_UpArrow = 0xb0,
60 LIcKey_LeftArrow = 0xb1,
61 LIcKey_DownArrow = 0xb2,
62 LIcKey_RightArrow = 0xb3,
63 LIcKey_NumLock = 0xb4,
64 LIcKey_Divide = 0xb5,
65 LIcKey_Multiply = 0xb6,
66 LIcKey_Subtract = 0xb7,
67 LIcKey_Add = 0xb8,
68 LIcKey_Decimal = 0xb9,
69 LIcKey_NumpadEnter = 0xba,
70 LIcKey_NumpadComma = 0xbb,
71 LIcKey_NumpadEquals = 0xbc,
72 LIcKey_Numpad0 = 0xbd,
73 LIcKey_Numpad1 = 0xbe,
74 LIcKey_Numpad2 = 0xbf,
75 LIcKey_Numpad3 = 0xc0,
76 LIcKey_Numpad4 = 0xc1,
77 LIcKey_Numpad5 = 0xc2,
78 LIcKey_Numpad6 = 0xc3,
79 LIcKey_Numpad7 = 0xc4,
80 LIcKey_Numpad8 = 0xc5,
81 LIcKey_Numpad9 = 0xc6,
82 LIcKey_LeftWindows = 0xc7, /* Mapped to 0x94 in LIgInputNames */
83 LIcKey_RightWindows = 0xc9, /* Mapped to 0x97 in LIgInputNames */
84 LIcKey_Max,
85};
86
87enum {
88 LIcActionType_None = 0,
89 LIcActionType_Digital = 1,
90 LIcActionType_Unknown = 2, // Unused in LIgActionDescriptions
91 LIcActionType_Accumulate = 3,
92 LIcActionType_Increment = 4,
93 LIcActionType_Decrement = 5,
94};
95
96typedef struct {
97 uint32_t input;
98 float analog;
99} LItDeviceInput;
100
101typedef struct {
102 uint64_t button_flags;
103 float analogs[10];
104} LItActionBuffer;
105
106typedef struct {
107 short type;
108 short index;
109 char name[32];
110} LItActionDescription;
111
112typedef struct {
113 int key;
114 LItActionDescription *descr;
115} LItBinding;
116
117typedef struct {
118 int event;
119 IMtPoint mouse_pos;
120 short ch;
121 /* short padding; */
122 int modifiers;
123} LItInputEvent;
124
125typedef struct {
126 char name[32];
127 int key;
128} LItInputName;
129
130#endif
Note: See TracBrowser for help on using the repository browser.