[#19232] (2.5) Correction of cmake for windows about audio (jack and openal)
[blender.git] / source / gameengine / GamePlayer / ghost / GPG_KeyboardDevice.cpp
1 /**
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  * GHOST Blender Player keyboard device implementation.
29  */
30
31 #include "GPG_KeyboardDevice.h"
32
33 #ifdef HAVE_CONFIG_H
34 #include <config.h>
35 #endif
36
37 GPG_KeyboardDevice::GPG_KeyboardDevice(void)
38 {
39         m_reverseKeyTranslateTable[GHOST_kKeyA                     ] = KX_AKEY                    ;                  
40         m_reverseKeyTranslateTable[GHOST_kKeyB                     ] = KX_BKEY                    ;                  
41         m_reverseKeyTranslateTable[GHOST_kKeyC                     ] = KX_CKEY                    ;                  
42         m_reverseKeyTranslateTable[GHOST_kKeyD                     ] = KX_DKEY                    ;                  
43         m_reverseKeyTranslateTable[GHOST_kKeyE                     ] = KX_EKEY                    ;                  
44         m_reverseKeyTranslateTable[GHOST_kKeyF                     ] = KX_FKEY                    ;                  
45         m_reverseKeyTranslateTable[GHOST_kKeyG                     ] = KX_GKEY                    ;                  
46         m_reverseKeyTranslateTable[GHOST_kKeyH                     ] = KX_HKEY                    ;                  
47         m_reverseKeyTranslateTable[GHOST_kKeyI                     ] = KX_IKEY                    ;                  
48         m_reverseKeyTranslateTable[GHOST_kKeyJ                     ] = KX_JKEY                    ;                  
49         m_reverseKeyTranslateTable[GHOST_kKeyK                     ] = KX_KKEY                    ;                  
50         m_reverseKeyTranslateTable[GHOST_kKeyL                     ] = KX_LKEY                    ;                  
51         m_reverseKeyTranslateTable[GHOST_kKeyM                     ] = KX_MKEY                    ;                  
52         m_reverseKeyTranslateTable[GHOST_kKeyN                     ] = KX_NKEY                    ;                  
53         m_reverseKeyTranslateTable[GHOST_kKeyO                     ] = KX_OKEY                    ;                  
54         m_reverseKeyTranslateTable[GHOST_kKeyP                     ] = KX_PKEY                    ;                  
55         m_reverseKeyTranslateTable[GHOST_kKeyQ                     ] = KX_QKEY                    ;                  
56         m_reverseKeyTranslateTable[GHOST_kKeyR                     ] = KX_RKEY                    ;                  
57         m_reverseKeyTranslateTable[GHOST_kKeyS                     ] = KX_SKEY                    ;                  
58         m_reverseKeyTranslateTable[GHOST_kKeyT                     ] = KX_TKEY                    ;                  
59         m_reverseKeyTranslateTable[GHOST_kKeyU                     ] = KX_UKEY                    ;                  
60         m_reverseKeyTranslateTable[GHOST_kKeyV                     ] = KX_VKEY                    ;                  
61         m_reverseKeyTranslateTable[GHOST_kKeyW                     ] = KX_WKEY                    ;                  
62         m_reverseKeyTranslateTable[GHOST_kKeyX                     ] = KX_XKEY                    ;                  
63         m_reverseKeyTranslateTable[GHOST_kKeyY                     ] = KX_YKEY                    ;                  
64         m_reverseKeyTranslateTable[GHOST_kKeyZ                     ] = KX_ZKEY                    ;                  
65
66         m_reverseKeyTranslateTable[GHOST_kKey0                     ] = KX_ZEROKEY                 ;                  
67         m_reverseKeyTranslateTable[GHOST_kKey1                     ] = KX_ONEKEY                  ;                  
68         m_reverseKeyTranslateTable[GHOST_kKey2                     ] = KX_TWOKEY                  ;                  
69         m_reverseKeyTranslateTable[GHOST_kKey3                     ] = KX_THREEKEY                ;                  
70         m_reverseKeyTranslateTable[GHOST_kKey4                     ] = KX_FOURKEY                 ;                  
71         m_reverseKeyTranslateTable[GHOST_kKey5                     ] = KX_FIVEKEY                 ;                  
72         m_reverseKeyTranslateTable[GHOST_kKey6                     ] = KX_SIXKEY                  ;                  
73         m_reverseKeyTranslateTable[GHOST_kKey7                     ] = KX_SEVENKEY                ;                  
74         m_reverseKeyTranslateTable[GHOST_kKey8                     ] = KX_EIGHTKEY                ;                  
75         m_reverseKeyTranslateTable[GHOST_kKey9                     ] = KX_NINEKEY                 ;
76         
77         // Middle keyboard area keys
78         m_reverseKeyTranslateTable[GHOST_kKeyPause                 ] = KX_PAUSEKEY                ;                  
79         m_reverseKeyTranslateTable[GHOST_kKeyInsert                ] = KX_INSERTKEY               ;                  
80         m_reverseKeyTranslateTable[GHOST_kKeyDelete                ] = KX_DELKEY                  ;                  
81         m_reverseKeyTranslateTable[GHOST_kKeyHome                  ] = KX_HOMEKEY                 ;                  
82         m_reverseKeyTranslateTable[GHOST_kKeyEnd                   ] = KX_ENDKEY                  ;                  
83         m_reverseKeyTranslateTable[GHOST_kKeyUpPage                ] = KX_PAGEUPKEY               ;                  
84         m_reverseKeyTranslateTable[GHOST_kKeyDownPage              ] = KX_PAGEDOWNKEY             ;                  
85         
86         // Arrow keys
87         m_reverseKeyTranslateTable[GHOST_kKeyUpArrow               ] = KX_UPARROWKEY              ;                  
88         m_reverseKeyTranslateTable[GHOST_kKeyDownArrow             ] = KX_DOWNARROWKEY            ;                  
89         m_reverseKeyTranslateTable[GHOST_kKeyLeftArrow             ] = KX_LEFTARROWKEY            ;                  
90         m_reverseKeyTranslateTable[GHOST_kKeyRightArrow            ] = KX_RIGHTARROWKEY           ;                  
91
92         // Function keys
93         m_reverseKeyTranslateTable[GHOST_kKeyF1                    ] = KX_F1KEY                   ;                  
94         m_reverseKeyTranslateTable[GHOST_kKeyF2                    ] = KX_F2KEY                   ;                  
95         m_reverseKeyTranslateTable[GHOST_kKeyF3                    ] = KX_F3KEY                   ;                  
96         m_reverseKeyTranslateTable[GHOST_kKeyF4                    ] = KX_F4KEY                   ;                  
97         m_reverseKeyTranslateTable[GHOST_kKeyF5                    ] = KX_F5KEY                   ;                  
98         m_reverseKeyTranslateTable[GHOST_kKeyF6                    ] = KX_F6KEY                   ;                  
99         m_reverseKeyTranslateTable[GHOST_kKeyF7                    ] = KX_F7KEY                   ;                  
100         m_reverseKeyTranslateTable[GHOST_kKeyF8                    ] = KX_F8KEY                   ;                  
101         m_reverseKeyTranslateTable[GHOST_kKeyF9                    ] = KX_F9KEY                   ;                  
102         m_reverseKeyTranslateTable[GHOST_kKeyF10                   ] = KX_F10KEY                  ;                  
103         m_reverseKeyTranslateTable[GHOST_kKeyF11                   ] = KX_F11KEY                  ;                  
104         m_reverseKeyTranslateTable[GHOST_kKeyF12                   ] = KX_F12KEY                  ;                  
105
106         // Numpad keys
107         m_reverseKeyTranslateTable[GHOST_kKeyNumpad0               ] = KX_PAD0                     ;                  
108         m_reverseKeyTranslateTable[GHOST_kKeyNumpad1               ] = KX_PAD1                     ;                  
109         m_reverseKeyTranslateTable[GHOST_kKeyNumpad2               ] = KX_PAD2                     ;                  
110         m_reverseKeyTranslateTable[GHOST_kKeyNumpad3               ] = KX_PAD3                     ;                  
111         m_reverseKeyTranslateTable[GHOST_kKeyNumpad4               ] = KX_PAD4                     ;                  
112         m_reverseKeyTranslateTable[GHOST_kKeyNumpad5               ] = KX_PAD5                     ;                  
113         m_reverseKeyTranslateTable[GHOST_kKeyNumpad6               ] = KX_PAD6                     ;                  
114         m_reverseKeyTranslateTable[GHOST_kKeyNumpad7               ] = KX_PAD7                     ;                  
115         m_reverseKeyTranslateTable[GHOST_kKeyNumpad8               ] = KX_PAD8                     ;                                                                                                       
116         m_reverseKeyTranslateTable[GHOST_kKeyNumpad9               ] = KX_PAD9                     ;                  
117         m_reverseKeyTranslateTable[GHOST_kKeyNumpadAsterisk        ] = KX_PADASTERKEY              ;                                                                                                                                                                                                                                   
118         m_reverseKeyTranslateTable[GHOST_kKeyNumpadPlus            ] = KX_PADPLUSKEY               ;                  
119         m_reverseKeyTranslateTable[GHOST_kKeyNumpadPeriod          ] = KX_PADPERIOD                ;                  
120         m_reverseKeyTranslateTable[GHOST_kKeyNumpadMinus           ] = KX_PADMINUS                 ;                  
121         m_reverseKeyTranslateTable[GHOST_kKeyNumpadSlash           ] = KX_PADSLASHKEY            ;                  
122         m_reverseKeyTranslateTable[GHOST_kKeyNumpadEnter           ] = KX_PADENTER                 ;                  
123
124         // Other keys
125         m_reverseKeyTranslateTable[GHOST_kKeyCapsLock              ] = KX_CAPSLOCKKEY              ;                  
126         m_reverseKeyTranslateTable[GHOST_kKeyEsc                   ] = KX_ESCKEY                   ;                  
127         m_reverseKeyTranslateTable[GHOST_kKeyTab                   ] = KX_TABKEY                   ;                  
128         m_reverseKeyTranslateTable[GHOST_kKeySpace                 ] = KX_SPACEKEY                 ;                  
129         m_reverseKeyTranslateTable[GHOST_kKeyEnter                 ] = KX_RETKEY                               ;                  
130         m_reverseKeyTranslateTable[GHOST_kKeyBackSpace             ] = KX_BACKSPACEKEY             ;                  
131         m_reverseKeyTranslateTable[GHOST_kKeySemicolon             ] = KX_SEMICOLONKEY             ;                  
132         m_reverseKeyTranslateTable[GHOST_kKeyPeriod                ] = KX_PERIODKEY                ;                  
133         m_reverseKeyTranslateTable[GHOST_kKeyComma                 ] = KX_COMMAKEY                 ;                  
134         m_reverseKeyTranslateTable[GHOST_kKeyQuote                 ] = KX_QUOTEKEY                 ;                  
135         m_reverseKeyTranslateTable[GHOST_kKeyAccentGrave           ] = KX_ACCENTGRAVEKEY           ;                  
136         m_reverseKeyTranslateTable[GHOST_kKeyMinus                 ] = KX_MINUSKEY                 ;                  
137         m_reverseKeyTranslateTable[GHOST_kKeySlash                     ] = KX_SLASHKEY                 ;                  
138         m_reverseKeyTranslateTable[GHOST_kKeyBackslash             ] = KX_BACKSLASHKEY             ;                  
139         m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;                  
140         m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket               ] = KX_LEFTBRACKETKEY           ;                  
141         m_reverseKeyTranslateTable[GHOST_kKeyRightBracket              ] = KX_RIGHTBRACKETKEY          ;                  
142
143         // Modifier keys.
144         m_reverseKeyTranslateTable[GHOST_kKeyLeftControl               ] = KX_LEFTCTRLKEY                  ;                  
145         m_reverseKeyTranslateTable[GHOST_kKeyRightControl              ] = KX_RIGHTCTRLKEY                 ;                  
146         m_reverseKeyTranslateTable[GHOST_kKeyLeftAlt               ] = KX_LEFTALTKEY               ;                  
147         m_reverseKeyTranslateTable[GHOST_kKeyRightAlt              ] = KX_RIGHTALTKEY              ;                  
148         m_reverseKeyTranslateTable[GHOST_kKeyLeftShift             ] = KX_LEFTSHIFTKEY             ;                  
149         m_reverseKeyTranslateTable[GHOST_kKeyRightShift            ] = KX_RIGHTSHIFTKEY            ;                  
150 }
151
152
153 GPG_KeyboardDevice::~GPG_KeyboardDevice(void)
154 {
155 }