1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Reto Grieder |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | /** |
---|
30 | @file |
---|
31 | @brief |
---|
32 | Declarations of various interface classes for the input management. |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _InputPrereqs_H__ |
---|
36 | #define _InputPrereqs_H__ |
---|
37 | |
---|
38 | #include "core/CorePrereqs.h" |
---|
39 | |
---|
40 | #include <ois/OISKeyboard.h> |
---|
41 | #include <ois/OISMouse.h> |
---|
42 | #include <ois/OISJoyStick.h> |
---|
43 | |
---|
44 | namespace orxonox |
---|
45 | { |
---|
46 | //----------------------------------------------------------------------- |
---|
47 | // Code enumerations |
---|
48 | //----------------------------------------------------------------------- |
---|
49 | |
---|
50 | namespace KeyCode |
---|
51 | { |
---|
52 | const unsigned int numberOfKeys = 0xEE; // 238 |
---|
53 | |
---|
54 | // note: KeyCode comments were directly copied from OISKeyboard.h |
---|
55 | enum ByEnum |
---|
56 | { |
---|
57 | Unassigned = OIS::KC_UNASSIGNED, |
---|
58 | Escape = OIS::KC_ESCAPE, |
---|
59 | NumRow1 = OIS::KC_1, |
---|
60 | NumRow2 = OIS::KC_2, |
---|
61 | NumRow3 = OIS::KC_3, |
---|
62 | NumRow4 = OIS::KC_4, |
---|
63 | NumRow5 = OIS::KC_5, |
---|
64 | NumRow6 = OIS::KC_6, |
---|
65 | NumRow7 = OIS::KC_7, |
---|
66 | NumRow8 = OIS::KC_8, |
---|
67 | NumRow9 = OIS::KC_9, |
---|
68 | NumRow0 = OIS::KC_0, |
---|
69 | Minus = OIS::KC_MINUS, // - on main keyboard |
---|
70 | Equals = OIS::KC_EQUALS, |
---|
71 | Back = OIS::KC_BACK, // backspace |
---|
72 | Tab = OIS::KC_TAB, |
---|
73 | Q = OIS::KC_Q, |
---|
74 | W = OIS::KC_W, |
---|
75 | E = OIS::KC_E, |
---|
76 | R = OIS::KC_R, |
---|
77 | T = OIS::KC_T, |
---|
78 | Y = OIS::KC_Y, |
---|
79 | U = OIS::KC_U, |
---|
80 | I = OIS::KC_I, |
---|
81 | O = OIS::KC_O, |
---|
82 | P = OIS::KC_P, |
---|
83 | LeftBracket = OIS::KC_LBRACKET, |
---|
84 | RightBracket = OIS::KC_RBRACKET, |
---|
85 | Return = OIS::KC_RETURN, // Enter on main keyboard |
---|
86 | LeftControl = OIS::KC_LCONTROL, |
---|
87 | A = OIS::KC_A, |
---|
88 | S = OIS::KC_S, |
---|
89 | D = OIS::KC_D, |
---|
90 | F = OIS::KC_F, |
---|
91 | G = OIS::KC_G, |
---|
92 | H = OIS::KC_H, |
---|
93 | J = OIS::KC_J, |
---|
94 | K = OIS::KC_K, |
---|
95 | L = OIS::KC_L, |
---|
96 | Semicolon = OIS::KC_SEMICOLON, |
---|
97 | Apostrophe = OIS::KC_APOSTROPHE, |
---|
98 | Grave = OIS::KC_GRAVE, // accent |
---|
99 | LeftShift = OIS::KC_LSHIFT, |
---|
100 | Backslash = OIS::KC_BACKSLASH, |
---|
101 | Z = OIS::KC_Z, |
---|
102 | X = OIS::KC_X, |
---|
103 | C = OIS::KC_C, |
---|
104 | V = OIS::KC_V, |
---|
105 | B = OIS::KC_B, |
---|
106 | N = OIS::KC_N, |
---|
107 | M = OIS::KC_M, |
---|
108 | Comma = OIS::KC_COMMA, |
---|
109 | Period = OIS::KC_PERIOD, // . on main keyboard |
---|
110 | Slash = OIS::KC_SLASH, // / on main keyboard |
---|
111 | RightShift = OIS::KC_RSHIFT, |
---|
112 | Multiply = OIS::KC_MULTIPLY, // * on numeric keypad |
---|
113 | LeftAlt = OIS::KC_LMENU, // left Alt |
---|
114 | Space = OIS::KC_SPACE, |
---|
115 | CapsLock = OIS::KC_CAPITAL, |
---|
116 | F1 = OIS::KC_F1, |
---|
117 | F2 = OIS::KC_F2, |
---|
118 | F3 = OIS::KC_F3, |
---|
119 | F4 = OIS::KC_F4, |
---|
120 | F5 = OIS::KC_F5, |
---|
121 | F6 = OIS::KC_F6, |
---|
122 | F7 = OIS::KC_F7, |
---|
123 | F8 = OIS::KC_F8, |
---|
124 | F9 = OIS::KC_F9, |
---|
125 | F10 = OIS::KC_F10, |
---|
126 | NumLock = OIS::KC_NUMLOCK, |
---|
127 | ScrollLock = OIS::KC_SCROLL, // Scroll Lock |
---|
128 | Numpad7 = OIS::KC_NUMPAD7, |
---|
129 | Numpad8 = OIS::KC_NUMPAD8, |
---|
130 | Numpad9 = OIS::KC_NUMPAD9, |
---|
131 | NumpadSubtract= OIS::KC_SUBTRACT, // - on numeric keypad |
---|
132 | Numpad4 = OIS::KC_NUMPAD4, |
---|
133 | Numpad5 = OIS::KC_NUMPAD5, |
---|
134 | Numpad6 = OIS::KC_NUMPAD6, |
---|
135 | NumpadAdd = OIS::KC_ADD, // + on numeric keypad |
---|
136 | Numpad1 = OIS::KC_NUMPAD1, |
---|
137 | Numpad2 = OIS::KC_NUMPAD2, |
---|
138 | Numpad3 = OIS::KC_NUMPAD3, |
---|
139 | Numpad0 = OIS::KC_NUMPAD0, |
---|
140 | NumpadPeriod = OIS::KC_DECIMAL, // . on numeric keypad |
---|
141 | LessThan = OIS::KC_OEM_102, // < > | on UK/Germany keyboards |
---|
142 | F11 = OIS::KC_F11, |
---|
143 | F12 = OIS::KC_F12, |
---|
144 | F13 = OIS::KC_F13, // (NEC PC98) |
---|
145 | F14 = OIS::KC_F14, // (NEC PC98) |
---|
146 | F15 = OIS::KC_F15, // (NEC PC98) |
---|
147 | Kana = OIS::KC_KANA, // (Japanese keyboard) |
---|
148 | ABNT_C1 = OIS::KC_ABNT_C1, // / ? on Portugese (Brazilian) keyboards |
---|
149 | Convert = OIS::KC_CONVERT, // (Japanese keyboard) |
---|
150 | NoConvert = OIS::KC_NOCONVERT, // (Japanese keyboard) |
---|
151 | Yen = OIS::KC_YEN, // (Japanese keyboard) |
---|
152 | ABNT_C2 = OIS::KC_ABNT_C2, // Numpad . on Portugese (Brazilian) keyboards |
---|
153 | NumpadEquals = OIS::KC_NUMPADEQUALS, // = on numeric keypad (NEC PC98) |
---|
154 | PreviousTrack = OIS::KC_PREVTRACK, // Previous Track (KC_CIRCUMFLEX on Japanese keyboard) |
---|
155 | AT = OIS::KC_AT, // (NEC PC98) |
---|
156 | Colon = OIS::KC_COLON, // (NEC PC98) |
---|
157 | Underline = OIS::KC_UNDERLINE, // (NEC PC98) |
---|
158 | Kanji = OIS::KC_KANJI, // (Japanese keyboard) |
---|
159 | Stop = OIS::KC_STOP, // (NEC PC98) |
---|
160 | AX = OIS::KC_AX, // (Japan AX) |
---|
161 | Unlabeled = OIS::KC_UNLABELED, // (J3100) |
---|
162 | NextTrack = OIS::KC_NEXTTRACK, // Next Track |
---|
163 | NumpadEnter = OIS::KC_NUMPADENTER, // Enter on numeric keypad |
---|
164 | RightControl = OIS::KC_RCONTROL, |
---|
165 | Mute = OIS::KC_MUTE, // Mute |
---|
166 | Calculator = OIS::KC_CALCULATOR, // Calculator |
---|
167 | PlayPause = OIS::KC_PLAYPAUSE, // Play / Pause |
---|
168 | MediaStop = OIS::KC_MEDIASTOP, // Media Stop |
---|
169 | VolumeDown = OIS::KC_VOLUMEDOWN, // Volume - |
---|
170 | VolumeUp = OIS::KC_VOLUMEUP, // Volume + |
---|
171 | WebHome = OIS::KC_WEBHOME, // Web home |
---|
172 | NumpadComma = OIS::KC_NUMPADCOMMA, // , on numeric keypad (NEC PC98) |
---|
173 | Divide = OIS::KC_DIVIDE, // / on numeric keypad |
---|
174 | SystemRequest = OIS::KC_SYSRQ, |
---|
175 | RightAlt = OIS::KC_RMENU, // right Alt |
---|
176 | Pause = OIS::KC_PAUSE, // Pause |
---|
177 | Home = OIS::KC_HOME, // Home on arrow keypad |
---|
178 | Up = OIS::KC_UP, // UpArrow on arrow keypad |
---|
179 | PageUp = OIS::KC_PGUP, // PgUp on arrow keypad |
---|
180 | Left = OIS::KC_LEFT, // LeftArrow on arrow keypad |
---|
181 | Right = OIS::KC_RIGHT, // RightArrow on arrow keypad |
---|
182 | End = OIS::KC_END, // End on arrow keypad |
---|
183 | Down = OIS::KC_DOWN, // DownArrow on arrow keypad |
---|
184 | PageDown = OIS::KC_PGDOWN, // PgDn on arrow keypad |
---|
185 | Insert = OIS::KC_INSERT, // Insert on arrow keypad |
---|
186 | Delete = OIS::KC_DELETE, // Delete on arrow keypad |
---|
187 | LeftWindows = OIS::KC_LWIN, // Left Windows key |
---|
188 | RightWindows = OIS::KC_RWIN, // Right Windows key |
---|
189 | Apps = OIS::KC_APPS, // AppMenu key |
---|
190 | Power = OIS::KC_POWER, // System Power |
---|
191 | Sleep = OIS::KC_SLEEP, // System Sleep |
---|
192 | Wake = OIS::KC_WAKE, // System Wake |
---|
193 | WebSearch = OIS::KC_WEBSEARCH, // Web Search |
---|
194 | WebFavorites = OIS::KC_WEBFAVORITES, // Web Favorites |
---|
195 | WebRefresh = OIS::KC_WEBREFRESH, // Web Refresh |
---|
196 | WebStop = OIS::KC_WEBSTOP, // Web Stop |
---|
197 | WebForward = OIS::KC_WEBFORWARD, // Web Forward |
---|
198 | WebBack = OIS::KC_WEBBACK, // Web Back |
---|
199 | MyComputer = OIS::KC_MYCOMPUTER, // My Computer |
---|
200 | Mail = OIS::KC_MAIL, // Mail |
---|
201 | MediaSelect = OIS::KC_MEDIASELECT // Media Select |
---|
202 | }; |
---|
203 | |
---|
204 | // Names as string. Has no real linkage! |
---|
205 | const char* const ByString[] = |
---|
206 | { |
---|
207 | "Unassigned", |
---|
208 | "Escape", |
---|
209 | "NumRow1", "NumRow2", "NumRow3", "NumRow4", "NumRow5", |
---|
210 | "NumRow6", "NumRow7", "NumRow8", "NumRow9", "NumRow0", |
---|
211 | "Minus", "Equals", "Back", "Tab", |
---|
212 | "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", |
---|
213 | "LeftBracket", "RightBracket", |
---|
214 | "Return", "LeftControl", |
---|
215 | "A", "S", "D", "F", "G", "H", "J", "K", "L", |
---|
216 | "Semicolon", "Apostrophe", "Grave", |
---|
217 | "LeftShift", "Backslash", |
---|
218 | "Z", "X", "C", "V", "B", "N", "M", |
---|
219 | "Comma", "Period", "Slash", |
---|
220 | "RightShift", |
---|
221 | "Multiply", |
---|
222 | "LeftAlt", |
---|
223 | "Space", |
---|
224 | "CapsLock", |
---|
225 | "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", |
---|
226 | "NumLock", "ScrollLock", |
---|
227 | "Numpad7", "Numpad8", "Numpad9", |
---|
228 | "NumpadSubtract", |
---|
229 | "Numpad4", "Numpad5", "Numpad6", |
---|
230 | "NumpadAdd", |
---|
231 | "Numpad1", "Numpad2", "Numpad3", "Numpad0", |
---|
232 | "NumpadPeriod", |
---|
233 | "","", |
---|
234 | "LessThan", |
---|
235 | "F11", "F12", |
---|
236 | "","","","","","","","","","","", |
---|
237 | "F13", "F14", "F15", |
---|
238 | "","","","","","","","","","", |
---|
239 | "Kana", |
---|
240 | "","", |
---|
241 | "ABNT_C1", |
---|
242 | "","","","","", |
---|
243 | "Convert", |
---|
244 | "", |
---|
245 | "NoConvert", |
---|
246 | "", |
---|
247 | "Yen", |
---|
248 | "ABNT_C2", |
---|
249 | "","","","","","","","","","","","","","", |
---|
250 | "NumpadEquals", |
---|
251 | "","", |
---|
252 | "PreviousTrack", |
---|
253 | "AT", |
---|
254 | "Colon", "Underline", |
---|
255 | "Kanji", |
---|
256 | "Stop", |
---|
257 | "AX", |
---|
258 | "Unlabeled", |
---|
259 | "NextTrack", |
---|
260 | "","", |
---|
261 | "NumpadEnter", |
---|
262 | "RightControl", |
---|
263 | "","", |
---|
264 | "Mute", |
---|
265 | "Calculator", |
---|
266 | "PlayPause", |
---|
267 | "", |
---|
268 | "MediaStop", |
---|
269 | "","","","","","","","","", |
---|
270 | "VolumeDown", |
---|
271 | "", |
---|
272 | "VolumeUp", |
---|
273 | "", |
---|
274 | "WebHome", |
---|
275 | "NumpadComma", |
---|
276 | "", |
---|
277 | "Divide", |
---|
278 | "", |
---|
279 | "SystemRequest", |
---|
280 | "RightAlt", |
---|
281 | "","","","","","","","","","","","", |
---|
282 | "Pause", |
---|
283 | "", |
---|
284 | "Home", |
---|
285 | "UP", |
---|
286 | "PageUp", |
---|
287 | "", |
---|
288 | "Left", |
---|
289 | "", |
---|
290 | "Right", |
---|
291 | "", |
---|
292 | "End", "Down", "PageDown", "Insert", "Delete", |
---|
293 | "","","","","","","", |
---|
294 | "LeftWindows", "RightWindows", "Apps", |
---|
295 | "Power", "Sleep", |
---|
296 | "","","", |
---|
297 | "Wake", |
---|
298 | "", |
---|
299 | "WebSearch", "WebFavorites", "WebRefresh", "WebStop", "WebForward", "WebBack", |
---|
300 | "MyComputer", "Mail", "MediaSelect" |
---|
301 | }; |
---|
302 | } |
---|
303 | |
---|
304 | |
---|
305 | namespace MouseButtonCode |
---|
306 | { |
---|
307 | const unsigned int numberOfButtons = 8; |
---|
308 | |
---|
309 | enum ByEnum |
---|
310 | { |
---|
311 | Left = OIS::MB_Left, |
---|
312 | Right = OIS::MB_Right, |
---|
313 | Middle = OIS::MB_Middle, |
---|
314 | Button3 = OIS::MB_Button3, |
---|
315 | Button4 = OIS::MB_Button4, |
---|
316 | Button5 = OIS::MB_Button5, |
---|
317 | Button6 = OIS::MB_Button6, |
---|
318 | Button7 = OIS::MB_Button7, |
---|
319 | }; |
---|
320 | |
---|
321 | // Names as string. Has no real linkage! |
---|
322 | const char* const ByString[] = |
---|
323 | { |
---|
324 | "Left", |
---|
325 | "Right", |
---|
326 | "Middle", |
---|
327 | "Button3", |
---|
328 | "Button4", |
---|
329 | "Button5", |
---|
330 | "Button6", |
---|
331 | "Button7", |
---|
332 | }; |
---|
333 | } |
---|
334 | |
---|
335 | namespace MouseAxisCode |
---|
336 | { |
---|
337 | const unsigned int numberOfAxes = 2; |
---|
338 | |
---|
339 | enum ByEnum |
---|
340 | { |
---|
341 | X, |
---|
342 | Y |
---|
343 | }; |
---|
344 | |
---|
345 | // Names as string. Has no real linkage! |
---|
346 | const char* const ByString[] = |
---|
347 | { |
---|
348 | "X", |
---|
349 | "Y" |
---|
350 | }; |
---|
351 | } |
---|
352 | |
---|
353 | |
---|
354 | namespace JoyStickButtonCode |
---|
355 | { |
---|
356 | const unsigned int numberOfButtons = 64; |
---|
357 | |
---|
358 | enum ByEnum |
---|
359 | { |
---|
360 | Button0 = 0, Button1 = 1, Button2 = 2, Button3 = 3, |
---|
361 | Button4 = 4, Button5 = 5, Button6 = 6, Button7 = 7, |
---|
362 | Button8 = 8, Button9 = 9, Button10 = 10, Button11 = 11, |
---|
363 | Button12 = 12, Button13 = 13, Button14 = 14, Button15 = 15, |
---|
364 | Button16 = 16, Button17 = 17, Button18 = 18, Button19 = 19, |
---|
365 | Button20 = 20, Button21 = 21, Button22 = 22, Button23 = 23, |
---|
366 | Button24 = 24, Button25 = 25, Button26 = 26, Button27 = 27, |
---|
367 | Button28 = 28, Button29 = 29, Button30 = 30, Button31 = 31, |
---|
368 | |
---|
369 | POV0North = 32, POV0South = 33, POV0East = 34, POV0West = 35, |
---|
370 | POV0NorthEast = 36, POV0SouthEast = 37, POV0NorthWest = 38, POV0SouthWest = 39, |
---|
371 | |
---|
372 | POV1North = 40, POV1South = 41, POV1East = 42, POV1West = 43, |
---|
373 | POV1NorthEast = 44, POV1SouthEast = 45, POV1NorthWest = 46, POV1SouthWest = 47, |
---|
374 | |
---|
375 | POV2North = 48, POV2South = 49, POV2East = 50, POV2West = 51, |
---|
376 | POV2NorthEast = 52, POV2SouthEast = 53, POV2NorthWest = 54, POV2SouthWest = 55, |
---|
377 | |
---|
378 | POV3North = 56, POV3South = 57, POV3East = 58, POV3West = 59, |
---|
379 | POV3NorthEast = 60, POV3SouthEast = 61, POV3NorthWest = 62, POV3SouthWest = 63, |
---|
380 | }; |
---|
381 | |
---|
382 | // Names as string. Has no real linkage! |
---|
383 | const char* const ByString[] = |
---|
384 | { |
---|
385 | "Button00", "Button01", "Button02", "Button03", |
---|
386 | "Button04", "Button05", "Button06", "Button07", |
---|
387 | "Button08", "Button09", "Button10", "Button11", |
---|
388 | "Button12", "Button13", "Button14", "Button15", |
---|
389 | "Button16", "Button17", "Button18", "Button19", |
---|
390 | "Button20", "Button21", "Button22", "Button23", |
---|
391 | "Button24", "Button25", "Button26", "Button27", |
---|
392 | "Button28", "Button29", "Button30", "Button31", |
---|
393 | "POV0North", "POV0South", "POV0East", "POV0West", |
---|
394 | "POV0NorthEast", "POV0SouthEast", "POV0NorthWest", "POV0SouthWest", |
---|
395 | "POV1North", "POV1South", "POV1East", "POV1West", |
---|
396 | "POV1NorthEast", "POV1SouthEast", "POV1NorthWest", "POV1SouthWest", |
---|
397 | "POV2North", "POV2South", "POV2East", "POV2West", |
---|
398 | "POV2NorthEast", "POV2SouthEast", "POV2NorthWest", "POV2SouthWest", |
---|
399 | "POV3North", "POV3South", "POV3East", "POV3West", |
---|
400 | "POV3NorthEast", "POV3SouthEast", "POV3NorthWest", "POV3SouthWest" |
---|
401 | }; |
---|
402 | } |
---|
403 | |
---|
404 | namespace JoyStickAxisCode |
---|
405 | { |
---|
406 | const unsigned int numberOfAxes = 24; |
---|
407 | |
---|
408 | enum ByEnum |
---|
409 | { |
---|
410 | Slider0 = 0, Slider1 = 1, Slider2 = 2, Slider3 = 3, |
---|
411 | Slider4 = 4, Slider5 = 5, Slider6 = 6, Slider7 = 7, |
---|
412 | Axis0 = 8, Axis1 = 9, Axis2 = 10, Axis3 = 11, |
---|
413 | Axis4 = 12, Axis5 = 13, Axis6 = 14, Axis7 = 15, |
---|
414 | Axis8 = 16, Axis9 = 17, Axis10 = 18, Axis11 = 19, |
---|
415 | Axis12 = 20, Axis13 = 21, Axis14 = 22, Axis15 = 23 |
---|
416 | }; |
---|
417 | |
---|
418 | // Names as string. Has no real linkage! |
---|
419 | const char* const ByString[] = |
---|
420 | { |
---|
421 | "Slider0", "Slider1", "Slider2", "Slider3", |
---|
422 | "Slider4", "Slider5", "Slider6", "Slider7", |
---|
423 | "Axis00", "Axis01", "Axis02", "Axis03", |
---|
424 | "Axis04", "Axis05", "Axis06", "Axis07", |
---|
425 | "Axis08", "Axis09", "Axis10", "Axis11", |
---|
426 | "Axis12", "Axis13", "Axis14", "Axis15" |
---|
427 | }; |
---|
428 | } |
---|
429 | |
---|
430 | |
---|
431 | //----------------------------------------------------------------------- |
---|
432 | // Miscellaneous |
---|
433 | //----------------------------------------------------------------------- |
---|
434 | |
---|
435 | namespace InputDeviceEnumerator |
---|
436 | { |
---|
437 | enum Value |
---|
438 | { |
---|
439 | Keyboard = 0, |
---|
440 | Mouse = 1, |
---|
441 | FirstJoyStick = 2 |
---|
442 | }; |
---|
443 | } |
---|
444 | |
---|
445 | namespace ButtonEvent |
---|
446 | { |
---|
447 | enum Value |
---|
448 | { |
---|
449 | Press, |
---|
450 | Release, |
---|
451 | Hold |
---|
452 | }; |
---|
453 | |
---|
454 | template <ButtonEvent::Value Event> |
---|
455 | struct EnumToType { }; |
---|
456 | typedef EnumToType<Press> TPress; |
---|
457 | typedef EnumToType<Release> TRelease; |
---|
458 | typedef EnumToType<Hold> THold; |
---|
459 | } |
---|
460 | |
---|
461 | |
---|
462 | namespace KeyboardModifier |
---|
463 | { |
---|
464 | enum Enum |
---|
465 | { |
---|
466 | Shift = 0x0000001, |
---|
467 | Ctrl = 0x0000010, |
---|
468 | Alt = 0x0000100 |
---|
469 | }; |
---|
470 | } |
---|
471 | |
---|
472 | class _CoreExport KeyEvent |
---|
473 | { |
---|
474 | public: |
---|
475 | KeyEvent(const OIS::KeyEvent& evt) |
---|
476 | : key_(static_cast<KeyCode::ByEnum>(evt.key)) |
---|
477 | , text_(evt.text) |
---|
478 | , modifiers_(0) |
---|
479 | { } |
---|
480 | bool operator==(const KeyEvent& rhs) const |
---|
481 | { return rhs.key_ == key_; } |
---|
482 | bool operator!=(const KeyEvent& rhs) const |
---|
483 | { return rhs.key_ != key_; } |
---|
484 | void setModifiers(int modifiers) |
---|
485 | { modifiers_ = modifiers; } |
---|
486 | |
---|
487 | bool isModifierDown(KeyboardModifier::Enum modifier) const |
---|
488 | { return static_cast<KeyboardModifier::Enum>(modifier & modifiers_); } |
---|
489 | KeyCode::ByEnum getKeyCode() const |
---|
490 | { return key_; } |
---|
491 | unsigned int getText() const { return text_; } |
---|
492 | |
---|
493 | private: |
---|
494 | KeyCode::ByEnum key_; |
---|
495 | unsigned int text_; |
---|
496 | int modifiers_; |
---|
497 | }; |
---|
498 | |
---|
499 | |
---|
500 | //----------------------------------------------------------------------- |
---|
501 | // Device type traits |
---|
502 | //----------------------------------------------------------------------- |
---|
503 | |
---|
504 | struct KeyboardTraits |
---|
505 | { |
---|
506 | typedef Keyboard DeviceClass; |
---|
507 | typedef OIS::Keyboard OISDeviceClass; |
---|
508 | typedef KeyEvent ButtonType; |
---|
509 | typedef KeyEvent& ButtonTypeParam; |
---|
510 | static const OIS::Type OISDeviceValue = OIS::OISKeyboard; |
---|
511 | }; |
---|
512 | |
---|
513 | struct MouseTraits |
---|
514 | { |
---|
515 | typedef Mouse DeviceClass; |
---|
516 | typedef OIS::Mouse OISDeviceClass; |
---|
517 | typedef MouseButtonCode::ByEnum ButtonType; |
---|
518 | typedef MouseButtonCode::ByEnum ButtonTypeParam; |
---|
519 | static const OIS::Type OISDeviceValue = OIS::OISMouse; |
---|
520 | }; |
---|
521 | |
---|
522 | struct JoyStickTraits |
---|
523 | { |
---|
524 | typedef JoyStick DeviceClass; |
---|
525 | typedef OIS::JoyStick OISDeviceClass; |
---|
526 | typedef JoyStickButtonCode::ByEnum ButtonType; |
---|
527 | typedef JoyStickButtonCode::ByEnum ButtonTypeParam; |
---|
528 | static const OIS::Type OISDeviceValue = OIS::OISJoyStick; |
---|
529 | }; |
---|
530 | |
---|
531 | // Note: Entries correspond to OIS::Type enum |
---|
532 | namespace InputDeviceNames |
---|
533 | { |
---|
534 | const char* const values[] = { "", "Keyboard", "Mouse", "JoyStick" }; |
---|
535 | } |
---|
536 | } |
---|
537 | |
---|
538 | #endif /* _InputPrereqs_H__ */ |
---|