Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6746 was 6746, checked in by rgrieder, 14 years ago

Merged gamestates2 branch back to trunk.
This brings in some heavy changes in the GUI framework.
It should also fix problems with triggered asserts in the InputManager.

Note: PickupInventory does not seem to work —> Segfault when showing because before, the owner in GUIOverlay::setGUIName is already NULL.
I haven't tested it before, so I can't tell whether it's my changes.

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