Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/input/InputPrereqs.h @ 11071

Last change on this file since 11071 was 11071, checked in by landauf, 8 years ago

merged branch cpp11_v3 back to trunk

  • Property svn:eol-style set to native
File size: 18.5 KB
Line 
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 all key/button/axis code enumeration and string literals
33    and an input device enumeration.
34*/
35
36#ifndef _InputPrereqs_H__
37#define _InputPrereqs_H__
38
39#include "core/CorePrereqs.h"
40
41#include <ois/OISKeyboard.h>
42#include <ois/OISMouse.h>
43#include "util/OrxEnum.h"
44
45namespace orxonox
46{
47    //-----------------------------------------------------------------------
48    // Code enumerations
49    //-----------------------------------------------------------------------
50
51    namespace KeyCode
52    {
53        const unsigned int numberOfKeys = 0xEE; // 238
54
55        //! Key codes as enumeration
56        enum ByEnum
57        {
58            Unassigned    = OIS::KC_UNASSIGNED,
59            Escape        = OIS::KC_ESCAPE,
60            NumRow1       = OIS::KC_1,
61            NumRow2       = OIS::KC_2,
62            NumRow3       = OIS::KC_3,
63            NumRow4       = OIS::KC_4,
64            NumRow5       = OIS::KC_5,
65            NumRow6       = OIS::KC_6,
66            NumRow7       = OIS::KC_7,
67            NumRow8       = OIS::KC_8,
68            NumRow9       = OIS::KC_9,
69            NumRow0       = OIS::KC_0,
70            Minus         = OIS::KC_MINUS,           // - on main keyboard
71            Equals        = OIS::KC_EQUALS,
72            Back          = OIS::KC_BACK,            // backspace
73            Tab           = OIS::KC_TAB,
74            Q             = OIS::KC_Q,
75            W             = OIS::KC_W,
76            E             = OIS::KC_E,
77            R             = OIS::KC_R,
78            T             = OIS::KC_T,
79            Y             = OIS::KC_Y,
80            U             = OIS::KC_U,
81            I             = OIS::KC_I,
82            O             = OIS::KC_O,
83            P             = OIS::KC_P,
84            LeftBracket   = OIS::KC_LBRACKET,
85            RightBracket  = OIS::KC_RBRACKET,
86            Return        = OIS::KC_RETURN,          // Enter on main keyboard
87            LeftControl   = OIS::KC_LCONTROL,
88            A             = OIS::KC_A,
89            S             = OIS::KC_S,
90            D             = OIS::KC_D,
91            F             = OIS::KC_F,
92            G             = OIS::KC_G,
93            H             = OIS::KC_H,
94            J             = OIS::KC_J,
95            K             = OIS::KC_K,
96            L             = OIS::KC_L,
97            Semicolon     = OIS::KC_SEMICOLON,
98            Apostrophe    = OIS::KC_APOSTROPHE,
99            Grave         = OIS::KC_GRAVE,           // accent
100            LeftShift     = OIS::KC_LSHIFT,
101            Backslash     = OIS::KC_BACKSLASH,
102            Z             = OIS::KC_Z,
103            X             = OIS::KC_X,
104            C             = OIS::KC_C,
105            V             = OIS::KC_V,
106            B             = OIS::KC_B,
107            N             = OIS::KC_N,
108            M             = OIS::KC_M,
109            Comma         = OIS::KC_COMMA,
110            Period        = OIS::KC_PERIOD,          // . on main keyboard
111            Slash         = OIS::KC_SLASH,           // / on main keyboard
112            RightShift    = OIS::KC_RSHIFT,
113            Multiply      = OIS::KC_MULTIPLY,        // * on numeric keypad
114            LeftAlt       = OIS::KC_LMENU,           // left Alt
115            Space         = OIS::KC_SPACE,
116            CapsLock      = OIS::KC_CAPITAL,
117            F1            = OIS::KC_F1,
118            F2            = OIS::KC_F2,
119            F3            = OIS::KC_F3,
120            F4            = OIS::KC_F4,
121            F5            = OIS::KC_F5,
122            F6            = OIS::KC_F6,
123            F7            = OIS::KC_F7,
124            F8            = OIS::KC_F8,
125            F9            = OIS::KC_F9,
126            F10           = OIS::KC_F10,
127            NumLock       = OIS::KC_NUMLOCK,
128            ScrollLock    = OIS::KC_SCROLL,          // Scroll Lock
129            Numpad7       = OIS::KC_NUMPAD7,
130            Numpad8       = OIS::KC_NUMPAD8,
131            Numpad9       = OIS::KC_NUMPAD9,
132            NumpadSubtract= OIS::KC_SUBTRACT,        // - on numeric keypad
133            Numpad4       = OIS::KC_NUMPAD4,
134            Numpad5       = OIS::KC_NUMPAD5,
135            Numpad6       = OIS::KC_NUMPAD6,
136            NumpadAdd     = OIS::KC_ADD,             // + on numeric keypad
137            Numpad1       = OIS::KC_NUMPAD1,
138            Numpad2       = OIS::KC_NUMPAD2,
139            Numpad3       = OIS::KC_NUMPAD3,
140            Numpad0       = OIS::KC_NUMPAD0,
141            NumpadPeriod  = OIS::KC_DECIMAL,         // . on numeric keypad
142            LessThan      = OIS::KC_OEM_102,         // < > | on UK/Germany keyboards
143            F11           = OIS::KC_F11,
144            F12           = OIS::KC_F12,
145            F13           = OIS::KC_F13,             //                     (NEC PC98)
146            F14           = OIS::KC_F14,             //                     (NEC PC98)
147            F15           = OIS::KC_F15,             //                     (NEC PC98)
148            Kana          = OIS::KC_KANA,            // (Japanese keyboard)
149            ABNT_C1       = OIS::KC_ABNT_C1,         // / ? on Portugese (Brazilian) keyboards
150            Convert       = OIS::KC_CONVERT,         // (Japanese keyboard)
151            NoConvert     = OIS::KC_NOCONVERT,       // (Japanese keyboard)
152            Yen           = OIS::KC_YEN,             // (Japanese keyboard)
153            ABNT_C2       = OIS::KC_ABNT_C2,         // Numpad . on Portugese (Brazilian) keyboards
154            NumpadEquals  = OIS::KC_NUMPADEQUALS,    // = on numeric keypad (NEC PC98)
155            PreviousTrack = OIS::KC_PREVTRACK,       // Previous Track (KC_CIRCUMFLEX on Japanese keyboard)
156            AT            = OIS::KC_AT,              //                     (NEC PC98)
157            Colon         = OIS::KC_COLON,           //                     (NEC PC98)
158            Underline     = OIS::KC_UNDERLINE,       //                     (NEC PC98)
159            Kanji         = OIS::KC_KANJI,           // (Japanese keyboard)
160            Stop          = OIS::KC_STOP,            //                     (NEC PC98)
161            AX            = OIS::KC_AX,              //                     (Japan AX)
162            Unlabeled     = OIS::KC_UNLABELED,       //                        (J3100)
163            NextTrack     = OIS::KC_NEXTTRACK,       // Next Track
164            NumpadEnter   = OIS::KC_NUMPADENTER,     // Enter on numeric keypad
165            RightControl  = OIS::KC_RCONTROL,
166            Mute          = OIS::KC_MUTE,            // Mute
167            Calculator    = OIS::KC_CALCULATOR,      // Calculator
168            PlayPause     = OIS::KC_PLAYPAUSE,       // Play / Pause
169            MediaStop     = OIS::KC_MEDIASTOP,       // Media Stop
170            VolumeDown    = OIS::KC_VOLUMEDOWN,      // Volume -
171            VolumeUp      = OIS::KC_VOLUMEUP,        // Volume +
172            WebHome       = OIS::KC_WEBHOME,         // Web home
173            NumpadComma   = OIS::KC_NUMPADCOMMA,     // , on numeric keypad (NEC PC98)
174            Divide        = OIS::KC_DIVIDE,          // / on numeric keypad
175            SystemRequest = OIS::KC_SYSRQ,
176            RightAlt      = OIS::KC_RMENU,           // right Alt
177            Pause         = OIS::KC_PAUSE,           // Pause
178            Home          = OIS::KC_HOME,            // Home on arrow keypad
179            Up            = OIS::KC_UP,              // UpArrow on arrow keypad
180            PageUp        = OIS::KC_PGUP,            // PgUp on arrow keypad
181            Left          = OIS::KC_LEFT,            // LeftArrow on arrow keypad
182            Right         = OIS::KC_RIGHT,           // RightArrow on arrow keypad
183            End           = OIS::KC_END,             // End on arrow keypad
184            Down          = OIS::KC_DOWN,            // DownArrow on arrow keypad
185            PageDown      = OIS::KC_PGDOWN,          // PgDn on arrow keypad
186            Insert        = OIS::KC_INSERT,          // Insert on arrow keypad
187            Delete        = OIS::KC_DELETE,          // Delete on arrow keypad
188            LeftWindows   = OIS::KC_LWIN,            // Left Windows key
189            RightWindows  = OIS::KC_RWIN,            // Right Windows key
190            Apps          = OIS::KC_APPS,            // AppMenu key
191            Power         = OIS::KC_POWER,           // System Power
192            Sleep         = OIS::KC_SLEEP,           // System Sleep
193            Wake          = OIS::KC_WAKE,            // System Wake
194            WebSearch     = OIS::KC_WEBSEARCH,       // Web Search
195            WebFavorites  = OIS::KC_WEBFAVORITES,    // Web Favorites
196            WebRefresh    = OIS::KC_WEBREFRESH,      // Web Refresh
197            WebStop       = OIS::KC_WEBSTOP,         // Web Stop
198            WebForward    = OIS::KC_WEBFORWARD,      // Web Forward
199            WebBack       = OIS::KC_WEBBACK,         // Web Back
200            MyComputer    = OIS::KC_MYCOMPUTER,      // My Computer
201            Mail          = OIS::KC_MAIL,            // Mail
202            MediaSelect   = OIS::KC_MEDIASELECT      // Media Select
203        };
204
205        //! Key codes as strings
206        const char* const ByString[] =
207        {
208            "Unassigned",
209            "Escape",
210            "NumRow1", "NumRow2", "NumRow3", "NumRow4", "NumRow5",
211            "NumRow6", "NumRow7", "NumRow8", "NumRow9", "NumRow0",
212            "Minus", "Equals", "Back", "Tab",
213            "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P",
214            "LeftBracket", "RightBracket",
215            "Return", "LeftControl",
216            "A", "S", "D", "F", "G", "H", "J", "K", "L",
217            "Semicolon", "Apostrophe", "Grave",
218            "LeftShift", "Backslash",
219            "Z", "X", "C", "V", "B", "N", "M",
220            "Comma", "Period", "Slash",
221            "RightShift",
222            "Multiply",
223            "LeftAlt",
224            "Space",
225            "CapsLock",
226            "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
227            "NumLock", "ScrollLock",
228            "Numpad7", "Numpad8", "Numpad9",
229            "NumpadSubtract",
230            "Numpad4", "Numpad5", "Numpad6",
231            "NumpadAdd",
232            "Numpad1", "Numpad2", "Numpad3", "Numpad0",
233            "NumpadPeriod",
234            "","",
235            "LessThan",
236            "F11", "F12",
237            "","","","","","","","","","","",
238            "F13", "F14", "F15",
239            "","","","","","","","","","",
240            "Kana",
241            "","",
242            "ABNT_C1",
243            "","","","","",
244            "Convert",
245            "",
246            "NoConvert",
247            "",
248            "Yen",
249            "ABNT_C2",
250            "","","","","","","","","","","","","","",
251            "NumpadEquals",
252            "","",
253            "PreviousTrack",
254            "AT",
255            "Colon", "Underline",
256            "Kanji",
257            "Stop",
258            "AX",
259            "Unlabeled",
260            "NextTrack",
261            "","",
262            "NumpadEnter",
263            "RightControl",
264            "","",
265            "Mute",
266            "Calculator",
267            "PlayPause",
268            "",
269            "MediaStop",
270            "","","","","","","","","",
271            "VolumeDown",
272            "",
273            "VolumeUp",
274            "",
275            "WebHome",
276            "NumpadComma",
277            "",
278            "Divide",
279            "",
280            "SystemRequest",
281            "RightAlt",
282            "","","","","","","","","","","","",
283            "Pause",
284            "",
285            "Home",
286            "UP",
287            "PageUp",
288            "",
289            "Left",
290            "",
291            "Right",
292            "",
293            "End", "Down", "PageDown", "Insert", "Delete",
294            "","","","","","","",
295            "LeftWindows", "RightWindows", "Apps",
296            "Power", "Sleep",
297            "","","",
298            "Wake",
299            "",
300            "WebSearch", "WebFavorites", "WebRefresh", "WebStop", "WebForward", "WebBack",
301            "MyComputer", "Mail", "MediaSelect"
302        };
303    }
304
305
306    namespace MouseButtonCode
307    {
308        const unsigned int numberOfButtons = 8;
309
310        //! Mouse button codes as enumeration
311        enum ByEnum
312        {
313            Left    = OIS::MB_Left,
314            Right   = OIS::MB_Right,
315            Middle  = OIS::MB_Middle,
316            Button3 = OIS::MB_Button3,
317            Button4 = OIS::MB_Button4,
318            Button5 = OIS::MB_Button5,
319            Button6 = OIS::MB_Button6,
320            Button7 = OIS::MB_Button7,
321        };
322
323        // Mouse button codes as strings
324        const char* const ByString[] =
325        {
326            "Left",
327            "Right",
328            "Middle",
329            "Button3",
330            "Button4",
331            "Button5",
332            "Button6",
333            "Button7",
334        };
335    }
336
337    namespace MouseAxisCode
338    {
339        const unsigned int numberOfAxes = 2;
340
341        // Mouse axis codes as enumeration
342        enum ByEnum
343        {
344            X,
345            Y
346        };
347
348        // Mouse axis codes as strings
349        const char* const ByString[] =
350        {
351            "X",
352            "Y"
353        };
354    }
355
356
357    namespace JoyStickButtonCode
358    {
359        const unsigned int numberOfButtons = 64;
360
361        // Joy stick button codes as enumeration
362        enum ByEnum
363        {
364            Button0       =  0, Button1       =  1, Button2       =  2, Button3       =  3,
365            Button4       =  4, Button5       =  5, Button6       =  6, Button7       =  7,
366            Button8       =  8, Button9       =  9, Button10      = 10, Button11      = 11,
367            Button12      = 12, Button13      = 13, Button14      = 14, Button15      = 15,
368            Button16      = 16, Button17      = 17, Button18      = 18, Button19      = 19,
369            Button20      = 20, Button21      = 21, Button22      = 22, Button23      = 23,
370            Button24      = 24, Button25      = 25, Button26      = 26, Button27      = 27,
371            Button28      = 28, Button29      = 29, Button30      = 30, Button31      = 31,
372
373            POV0North     = 32, POV0South     = 33, POV0East      = 34, POV0West      = 35,
374            POV0NorthEast = 36, POV0SouthEast = 37, POV0NorthWest = 38, POV0SouthWest = 39,
375
376            POV1North     = 40, POV1South     = 41, POV1East      = 42, POV1West      = 43,
377            POV1NorthEast = 44, POV1SouthEast = 45, POV1NorthWest = 46, POV1SouthWest = 47,
378
379            POV2North     = 48, POV2South     = 49, POV2East      = 50, POV2West      = 51,
380            POV2NorthEast = 52, POV2SouthEast = 53, POV2NorthWest = 54, POV2SouthWest = 55,
381
382            POV3North     = 56, POV3South     = 57, POV3East      = 58, POV3West      = 59,
383            POV3NorthEast = 60, POV3SouthEast = 61, POV3NorthWest = 62, POV3SouthWest = 63,
384        };
385
386        // Joy stick button codes as strings
387        const char* const ByString[] =
388        {
389            "Button00",      "Button01",      "Button02",      "Button03",
390            "Button04",      "Button05",      "Button06",      "Button07",
391            "Button08",      "Button09",      "Button10",      "Button11",
392            "Button12",      "Button13",      "Button14",      "Button15",
393            "Button16",      "Button17",      "Button18",      "Button19",
394            "Button20",      "Button21",      "Button22",      "Button23",
395            "Button24",      "Button25",      "Button26",      "Button27",
396            "Button28",      "Button29",      "Button30",      "Button31",
397            "POV0North",     "POV0South",     "POV0East",      "POV0West",
398            "POV0NorthEast", "POV0SouthEast", "POV0NorthWest", "POV0SouthWest",
399            "POV1North",     "POV1South",     "POV1East",      "POV1West",
400            "POV1NorthEast", "POV1SouthEast", "POV1NorthWest", "POV1SouthWest",
401            "POV2North",     "POV2South",     "POV2East",      "POV2West",
402            "POV2NorthEast", "POV2SouthEast", "POV2NorthWest", "POV2SouthWest",
403            "POV3North",     "POV3South",     "POV3East",      "POV3West",
404            "POV3NorthEast", "POV3SouthEast", "POV3NorthWest", "POV3SouthWest"
405        };
406    }
407
408    namespace JoyStickAxisCode
409    {
410        const unsigned int numberOfAxes = 24;
411
412        // Joy stick axis codes as enumeration
413        enum ByEnum
414        {
415            Slider0 =  0, Slider1 =  1, Slider2 =  2, Slider3 =  3,
416            Slider4 =  4, Slider5 =  5, Slider6 =  6, Slider7 =  7,
417            Axis0   =  8, Axis1   =  9, Axis2   = 10, Axis3   = 11,
418            Axis4   = 12, Axis5   = 13, Axis6   = 14, Axis7   = 15,
419            Axis8   = 16, Axis9   = 17, Axis10  = 18, Axis11  = 19,
420            Axis12  = 20, Axis13  = 21, Axis14  = 22, Axis15  = 23
421        };
422
423        // Joy stick axis codes as strings
424        const char* const ByString[] =
425        {
426            "Slider0", "Slider1", "Slider2", "Slider3",
427            "Slider4", "Slider5", "Slider6", "Slider7",
428            "Axis00",  "Axis01",  "Axis02",  "Axis03",
429            "Axis04",  "Axis05",  "Axis06",  "Axis07",
430            "Axis08",  "Axis09",  "Axis10",  "Axis11",
431            "Axis12",  "Axis13",  "Axis14",  "Axis15"
432        };
433    }
434
435
436    //-----------------------------------------------------------------------
437    // Miscellaneous
438    //-----------------------------------------------------------------------
439
440    namespace InputDeviceEnumerator
441    {
442        //! Used to access the devices in an array
443        enum Value
444        {
445            Keyboard = 0,
446            Mouse = 1,
447            FirstJoyStick = 2
448        };
449    }
450
451    //! Enumeration wrapper for input state priorities
452    struct InputStatePriority : OrxEnum<InputStatePriority>
453    {
454        OrxEnumConstructors(InputStatePriority);
455
456        static constexpr int Empty        = -1;
457        static constexpr int Dynamic      = 0;
458
459        static constexpr int HighPriority = 1000;
460        static constexpr int Console      = HighPriority + 0;
461        static constexpr int Calibrator   = HighPriority + 1;
462        static constexpr int Detector     = HighPriority + 2;
463    };
464}
465
466#endif /* _InputPrereqs_H__ */
Note: See TracBrowser for help on using the repository browser.