Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/console/src/libraries/core/input/InputPrereqs.h @ 5986

Last change on this file since 5986 was 5986, checked in by scheusso, 15 years ago

added a new feature to the IOConsole: you can now search the history (like in bash shells) with PgUP
just enter a few signs/characters of a command you once typed in and press PgUP to complete the command
if the found command is not the one you were looking for just press PgUP again

  • Property svn:eol-style set to native
File size: 18.3 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 <ois/OISJoyStick.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            AltPageUp     = OIS::KC_PGUP+1,          // Alternative PgUp for the IOConsole
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            AltPageDown   = OIS::KC_END-1,           // Alternative PgUp for IOConsole
188            Insert        = OIS::KC_INSERT,          // Insert on arrow keypad
189            Delete        = OIS::KC_DELETE,          // Delete on arrow keypad
190            LeftWindows   = OIS::KC_LWIN,            // Left Windows key
191            RightWindows  = OIS::KC_RWIN,            // Right Windows key
192            Apps          = OIS::KC_APPS,            // AppMenu key
193            Power         = OIS::KC_POWER,           // System Power
194            Sleep         = OIS::KC_SLEEP,           // System Sleep
195            Wake          = OIS::KC_WAKE,            // System Wake
196            WebSearch     = OIS::KC_WEBSEARCH,       // Web Search
197            WebFavorites  = OIS::KC_WEBFAVORITES,    // Web Favorites
198            WebRefresh    = OIS::KC_WEBREFRESH,      // Web Refresh
199            WebStop       = OIS::KC_WEBSTOP,         // Web Stop
200            WebForward    = OIS::KC_WEBFORWARD,      // Web Forward
201            WebBack       = OIS::KC_WEBBACK,         // Web Back
202            MyComputer    = OIS::KC_MYCOMPUTER,      // My Computer
203            Mail          = OIS::KC_MAIL,            // Mail
204            MediaSelect   = OIS::KC_MEDIASELECT      // Media Select
205        };
206       
207        //! Key codes as strings
208        const char* const ByString[] =
209        {
210            "Unassigned",
211            "Escape",
212            "NumRow1", "NumRow2", "NumRow3", "NumRow4", "NumRow5",
213            "NumRow6", "NumRow7", "NumRow8", "NumRow9", "NumRow0",
214            "Minus", "Equals", "Back", "Tab",
215            "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P",
216            "LeftBracket", "RightBracket",
217            "Return", "LeftControl",
218            "A", "S", "D", "F", "G", "H", "J", "K", "L",
219            "Semicolon", "Apostrophe", "Grave",
220            "LeftShift", "Backslash",
221            "Z", "X", "C", "V", "B", "N", "M",
222            "Comma", "Period", "Slash",
223            "RightShift",
224            "Multiply",
225            "LeftAlt",
226            "Space",
227            "CapsLock",
228            "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10",
229            "NumLock", "ScrollLock",
230            "Numpad7", "Numpad8", "Numpad9",
231            "NumpadSubtract",
232            "Numpad4", "Numpad5", "Numpad6",
233            "NumpadAdd",
234            "Numpad1", "Numpad2", "Numpad3", "Numpad0",
235            "NumpadPeriod",
236            "","",
237            "LessThan",
238            "F11", "F12",
239            "","","","","","","","","","","",
240            "F13", "F14", "F15",
241            "","","","","","","","","","",
242            "Kana",
243            "","",
244            "ABNT_C1",
245            "","","","","",
246            "Convert",
247            "",
248            "NoConvert",
249            "",
250            "Yen",
251            "ABNT_C2",
252            "","","","","","","","","","","","","","",
253            "NumpadEquals",
254            "","",
255            "PreviousTrack",
256            "AT",
257            "Colon", "Underline",
258            "Kanji",
259            "Stop",
260            "AX",
261            "Unlabeled",
262            "NextTrack",
263            "","",
264            "NumpadEnter",
265            "RightControl",
266            "","",
267            "Mute",
268            "Calculator",
269            "PlayPause",
270            "",
271            "MediaStop",
272            "","","","","","","","","",
273            "VolumeDown",
274            "",
275            "VolumeUp",
276            "",
277            "WebHome",
278            "NumpadComma",
279            "",
280            "Divide",
281            "",
282            "SystemRequest",
283            "RightAlt",
284            "","","","","","","","","","","","",
285            "Pause",
286            "",
287            "Home",
288            "UP",
289            "PageUp",
290            "", // used for AltPageUp
291            "Left",
292            "",
293            "Right",
294            "", // used for AltPageDown
295            "End", "Down", "PageDown", "Insert", "Delete",
296            "","","","","","","",
297            "LeftWindows", "RightWindows", "Apps",
298            "Power", "Sleep",
299            "","","",
300            "Wake",
301            "",
302            "WebSearch", "WebFavorites", "WebRefresh", "WebStop", "WebForward", "WebBack",
303            "MyComputer", "Mail", "MediaSelect"
304        };
305    }
306
307
308    namespace MouseButtonCode
309    {
310        const unsigned int numberOfButtons = 8;
311
312        //! Mouse button codes as enumeration
313        enum ByEnum
314        {
315            Left    = OIS::MB_Left,
316            Right   = OIS::MB_Right,
317            Middle  = OIS::MB_Middle,
318            Button3 = OIS::MB_Button3,
319            Button4 = OIS::MB_Button4,
320            Button5 = OIS::MB_Button5,
321            Button6 = OIS::MB_Button6,
322            Button7 = OIS::MB_Button7,
323        };
324
325        // Mouse button codes as strings
326        const char* const ByString[] =
327        {
328            "Left",
329            "Right",
330            "Middle",
331            "Button3",
332            "Button4",
333            "Button5",
334            "Button6",
335            "Button7",
336        };
337    }
338
339    namespace MouseAxisCode
340    {
341        const unsigned int numberOfAxes = 2;
342
343        // Mouse axis codes as enumeration
344        enum ByEnum
345        {
346            X,
347            Y
348        };
349
350        // Mouse axis codes as strings
351        const char* const ByString[] =
352        {
353            "X",
354            "Y"
355        };
356    }
357
358
359    namespace JoyStickButtonCode
360    {
361        const unsigned int numberOfButtons = 64;
362
363        // Joy stick button codes as enumeration
364        enum ByEnum
365        {
366            Button0       =  0, Button1       =  1, Button2       =  2, Button3       =  3,
367            Button4       =  4, Button5       =  5, Button6       =  6, Button7       =  7,
368            Button8       =  8, Button9       =  9, Button10      = 10, Button11      = 11,
369            Button12      = 12, Button13      = 13, Button14      = 14, Button15      = 15,
370            Button16      = 16, Button17      = 17, Button18      = 18, Button19      = 19,
371            Button20      = 20, Button21      = 21, Button22      = 22, Button23      = 23,
372            Button24      = 24, Button25      = 25, Button26      = 26, Button27      = 27,
373            Button28      = 28, Button29      = 29, Button30      = 30, Button31      = 31,
374
375            POV0North     = 32, POV0South     = 33, POV0East      = 34, POV0West      = 35,
376            POV0NorthEast = 36, POV0SouthEast = 37, POV0NorthWest = 38, POV0SouthWest = 39,
377
378            POV1North     = 40, POV1South     = 41, POV1East      = 42, POV1West      = 43,
379            POV1NorthEast = 44, POV1SouthEast = 45, POV1NorthWest = 46, POV1SouthWest = 47,
380
381            POV2North     = 48, POV2South     = 49, POV2East      = 50, POV2West      = 51,
382            POV2NorthEast = 52, POV2SouthEast = 53, POV2NorthWest = 54, POV2SouthWest = 55,
383
384            POV3North     = 56, POV3South     = 57, POV3East      = 58, POV3West      = 59,
385            POV3NorthEast = 60, POV3SouthEast = 61, POV3NorthWest = 62, POV3SouthWest = 63,
386        };
387
388        // Joy stick button codes as strings
389        const char* const ByString[] =
390        {
391            "Button00",      "Button01",      "Button02",      "Button03",
392            "Button04",      "Button05",      "Button06",      "Button07",
393            "Button08",      "Button09",      "Button10",      "Button11",
394            "Button12",      "Button13",      "Button14",      "Button15",
395            "Button16",      "Button17",      "Button18",      "Button19",
396            "Button20",      "Button21",      "Button22",      "Button23",
397            "Button24",      "Button25",      "Button26",      "Button27",
398            "Button28",      "Button29",      "Button30",      "Button31",
399            "POV0North",     "POV0South",     "POV0East",      "POV0West",
400            "POV0NorthEast", "POV0SouthEast", "POV0NorthWest", "POV0SouthWest",
401            "POV1North",     "POV1South",     "POV1East",      "POV1West",
402            "POV1NorthEast", "POV1SouthEast", "POV1NorthWest", "POV1SouthWest",
403            "POV2North",     "POV2South",     "POV2East",      "POV2West",
404            "POV2NorthEast", "POV2SouthEast", "POV2NorthWest", "POV2SouthWest",
405            "POV3North",     "POV3South",     "POV3East",      "POV3West",
406            "POV3NorthEast", "POV3SouthEast", "POV3NorthWest", "POV3SouthWest"
407        };
408    }
409
410    namespace JoyStickAxisCode
411    {
412        const unsigned int numberOfAxes = 24;
413
414        // Joy stick axis codes as enumeration
415        enum ByEnum
416        {
417            Slider0 =  0, Slider1 =  1, Slider2 =  2, Slider3 =  3,
418            Slider4 =  4, Slider5 =  5, Slider6 =  6, Slider7 =  7,
419            Axis0   =  8, Axis1   =  9, Axis2   = 10, Axis3   = 11,
420            Axis4   = 12, Axis5   = 13, Axis6   = 14, Axis7   = 15,
421            Axis8   = 16, Axis9   = 17, Axis10  = 18, Axis11  = 19,
422            Axis12  = 20, Axis13  = 21, Axis14  = 22, Axis15  = 23
423        };
424
425        // Joy stick axis codes as strings
426        const char* const ByString[] =
427        {
428            "Slider0", "Slider1", "Slider2", "Slider3",
429            "Slider4", "Slider5", "Slider6", "Slider7",
430            "Axis00",  "Axis01",  "Axis02",  "Axis03",
431            "Axis04",  "Axis05",  "Axis06",  "Axis07",
432            "Axis08",  "Axis09",  "Axis10",  "Axis11",
433            "Axis12",  "Axis13",  "Axis14",  "Axis15"
434        };
435    }
436
437
438    //-----------------------------------------------------------------------
439    // Miscellaneous
440    //-----------------------------------------------------------------------
441
442    namespace InputDeviceEnumerator
443    {
444        //! Used to access the devices in an array
445        enum Value
446        {
447            Keyboard = 0,
448            Mouse = 1,
449            FirstJoyStick = 2
450        };
451    }
452}
453
454#endif /* _InputPrereqs_H__ */
Note: See TracBrowser for help on using the repository browser.