Blender V2.61 - r43446

GPG_KeyboardDevice.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  * GHOST Blender Player keyboard device implementation.
00027  */
00028 
00034 #include "GPG_KeyboardDevice.h"
00035 
00036 GPG_KeyboardDevice::GPG_KeyboardDevice(void)
00037 {
00038     m_reverseKeyTranslateTable[GHOST_kKeyA                     ] = KX_AKEY                    ;                  
00039     m_reverseKeyTranslateTable[GHOST_kKeyB                     ] = KX_BKEY                    ;                  
00040     m_reverseKeyTranslateTable[GHOST_kKeyC                     ] = KX_CKEY                    ;                  
00041     m_reverseKeyTranslateTable[GHOST_kKeyD                     ] = KX_DKEY                    ;                  
00042     m_reverseKeyTranslateTable[GHOST_kKeyE                     ] = KX_EKEY                    ;                  
00043     m_reverseKeyTranslateTable[GHOST_kKeyF                     ] = KX_FKEY                    ;                  
00044     m_reverseKeyTranslateTable[GHOST_kKeyG                     ] = KX_GKEY                    ;                  
00045     m_reverseKeyTranslateTable[GHOST_kKeyH                     ] = KX_HKEY                    ;                  
00046     m_reverseKeyTranslateTable[GHOST_kKeyI                     ] = KX_IKEY                    ;                  
00047     m_reverseKeyTranslateTable[GHOST_kKeyJ                     ] = KX_JKEY                    ;                  
00048     m_reverseKeyTranslateTable[GHOST_kKeyK                     ] = KX_KKEY                    ;                  
00049     m_reverseKeyTranslateTable[GHOST_kKeyL                     ] = KX_LKEY                    ;                  
00050     m_reverseKeyTranslateTable[GHOST_kKeyM                     ] = KX_MKEY                    ;                  
00051     m_reverseKeyTranslateTable[GHOST_kKeyN                     ] = KX_NKEY                    ;                  
00052     m_reverseKeyTranslateTable[GHOST_kKeyO                     ] = KX_OKEY                    ;                  
00053     m_reverseKeyTranslateTable[GHOST_kKeyP                     ] = KX_PKEY                    ;                  
00054     m_reverseKeyTranslateTable[GHOST_kKeyQ                     ] = KX_QKEY                    ;                  
00055     m_reverseKeyTranslateTable[GHOST_kKeyR                     ] = KX_RKEY                    ;                  
00056     m_reverseKeyTranslateTable[GHOST_kKeyS                     ] = KX_SKEY                    ;                  
00057     m_reverseKeyTranslateTable[GHOST_kKeyT                     ] = KX_TKEY                    ;                  
00058     m_reverseKeyTranslateTable[GHOST_kKeyU                     ] = KX_UKEY                    ;                  
00059     m_reverseKeyTranslateTable[GHOST_kKeyV                     ] = KX_VKEY                    ;                  
00060     m_reverseKeyTranslateTable[GHOST_kKeyW                     ] = KX_WKEY                    ;                  
00061     m_reverseKeyTranslateTable[GHOST_kKeyX                     ] = KX_XKEY                    ;                  
00062     m_reverseKeyTranslateTable[GHOST_kKeyY                     ] = KX_YKEY                    ;                  
00063     m_reverseKeyTranslateTable[GHOST_kKeyZ                     ] = KX_ZKEY                    ;                  
00064 
00065     m_reverseKeyTranslateTable[GHOST_kKey0                     ] = KX_ZEROKEY                 ;                  
00066     m_reverseKeyTranslateTable[GHOST_kKey1                     ] = KX_ONEKEY                  ;                  
00067     m_reverseKeyTranslateTable[GHOST_kKey2                     ] = KX_TWOKEY                  ;                  
00068     m_reverseKeyTranslateTable[GHOST_kKey3                     ] = KX_THREEKEY                ;                  
00069     m_reverseKeyTranslateTable[GHOST_kKey4                     ] = KX_FOURKEY                 ;                  
00070     m_reverseKeyTranslateTable[GHOST_kKey5                     ] = KX_FIVEKEY                 ;                  
00071     m_reverseKeyTranslateTable[GHOST_kKey6                     ] = KX_SIXKEY                  ;                  
00072     m_reverseKeyTranslateTable[GHOST_kKey7                     ] = KX_SEVENKEY                ;                  
00073     m_reverseKeyTranslateTable[GHOST_kKey8                     ] = KX_EIGHTKEY                ;                  
00074     m_reverseKeyTranslateTable[GHOST_kKey9                     ] = KX_NINEKEY                 ;
00075     
00076     // Middle keyboard area keys
00077     m_reverseKeyTranslateTable[GHOST_kKeyPause                 ] = KX_PAUSEKEY                ;                  
00078     m_reverseKeyTranslateTable[GHOST_kKeyInsert                ] = KX_INSERTKEY               ;                  
00079     m_reverseKeyTranslateTable[GHOST_kKeyDelete                ] = KX_DELKEY                  ;                  
00080     m_reverseKeyTranslateTable[GHOST_kKeyHome                  ] = KX_HOMEKEY                 ;                  
00081     m_reverseKeyTranslateTable[GHOST_kKeyEnd                   ] = KX_ENDKEY                  ;                  
00082     m_reverseKeyTranslateTable[GHOST_kKeyUpPage                ] = KX_PAGEUPKEY               ;                  
00083     m_reverseKeyTranslateTable[GHOST_kKeyDownPage              ] = KX_PAGEDOWNKEY             ;                  
00084     
00085     // Arrow keys
00086     m_reverseKeyTranslateTable[GHOST_kKeyUpArrow               ] = KX_UPARROWKEY              ;                  
00087     m_reverseKeyTranslateTable[GHOST_kKeyDownArrow             ] = KX_DOWNARROWKEY            ;                  
00088     m_reverseKeyTranslateTable[GHOST_kKeyLeftArrow             ] = KX_LEFTARROWKEY            ;                  
00089     m_reverseKeyTranslateTable[GHOST_kKeyRightArrow            ] = KX_RIGHTARROWKEY           ;                  
00090 
00091     // Function keys
00092     m_reverseKeyTranslateTable[GHOST_kKeyF1                    ] = KX_F1KEY                   ;                  
00093     m_reverseKeyTranslateTable[GHOST_kKeyF2                    ] = KX_F2KEY                   ;                  
00094     m_reverseKeyTranslateTable[GHOST_kKeyF3                    ] = KX_F3KEY                   ;                  
00095     m_reverseKeyTranslateTable[GHOST_kKeyF4                    ] = KX_F4KEY                   ;                  
00096     m_reverseKeyTranslateTable[GHOST_kKeyF5                    ] = KX_F5KEY                   ;                  
00097     m_reverseKeyTranslateTable[GHOST_kKeyF6                    ] = KX_F6KEY                   ;                  
00098     m_reverseKeyTranslateTable[GHOST_kKeyF7                    ] = KX_F7KEY                   ;                  
00099     m_reverseKeyTranslateTable[GHOST_kKeyF8                    ] = KX_F8KEY                   ;                  
00100     m_reverseKeyTranslateTable[GHOST_kKeyF9                    ] = KX_F9KEY                   ;                  
00101     m_reverseKeyTranslateTable[GHOST_kKeyF10                   ] = KX_F10KEY                  ;                  
00102     m_reverseKeyTranslateTable[GHOST_kKeyF11                   ] = KX_F11KEY                  ;                  
00103     m_reverseKeyTranslateTable[GHOST_kKeyF12                   ] = KX_F12KEY                  ;
00104     m_reverseKeyTranslateTable[GHOST_kKeyF13                   ] = KX_F13KEY                  ;
00105     m_reverseKeyTranslateTable[GHOST_kKeyF14                   ] = KX_F14KEY                  ;
00106     m_reverseKeyTranslateTable[GHOST_kKeyF15                   ] = KX_F15KEY                  ;
00107     m_reverseKeyTranslateTable[GHOST_kKeyF16                   ] = KX_F16KEY                  ;
00108     m_reverseKeyTranslateTable[GHOST_kKeyF17                   ] = KX_F17KEY                  ;
00109     m_reverseKeyTranslateTable[GHOST_kKeyF18                   ] = KX_F18KEY                  ;
00110     m_reverseKeyTranslateTable[GHOST_kKeyF19                   ] = KX_F19KEY                  ;
00111     
00112 
00113     // Numpad keys
00114     m_reverseKeyTranslateTable[GHOST_kKeyNumpad0               ] = KX_PAD0                     ;                  
00115     m_reverseKeyTranslateTable[GHOST_kKeyNumpad1               ] = KX_PAD1                     ;                  
00116     m_reverseKeyTranslateTable[GHOST_kKeyNumpad2               ] = KX_PAD2                     ;                  
00117     m_reverseKeyTranslateTable[GHOST_kKeyNumpad3               ] = KX_PAD3                     ;                  
00118     m_reverseKeyTranslateTable[GHOST_kKeyNumpad4               ] = KX_PAD4                     ;                  
00119     m_reverseKeyTranslateTable[GHOST_kKeyNumpad5               ] = KX_PAD5                     ;                  
00120     m_reverseKeyTranslateTable[GHOST_kKeyNumpad6               ] = KX_PAD6                     ;                  
00121     m_reverseKeyTranslateTable[GHOST_kKeyNumpad7               ] = KX_PAD7                     ;                  
00122     m_reverseKeyTranslateTable[GHOST_kKeyNumpad8               ] = KX_PAD8                     ;                                                                                                       
00123     m_reverseKeyTranslateTable[GHOST_kKeyNumpad9               ] = KX_PAD9                     ;                  
00124     m_reverseKeyTranslateTable[GHOST_kKeyNumpadAsterisk        ] = KX_PADASTERKEY              ;                                                                                                                                                                                                                               
00125     m_reverseKeyTranslateTable[GHOST_kKeyNumpadPlus            ] = KX_PADPLUSKEY               ;                  
00126     m_reverseKeyTranslateTable[GHOST_kKeyNumpadPeriod          ] = KX_PADPERIOD                ;                  
00127     m_reverseKeyTranslateTable[GHOST_kKeyNumpadMinus           ] = KX_PADMINUS                 ;                  
00128     m_reverseKeyTranslateTable[GHOST_kKeyNumpadSlash           ] = KX_PADSLASHKEY            ;                  
00129     m_reverseKeyTranslateTable[GHOST_kKeyNumpadEnter           ] = KX_PADENTER                 ;                  
00130 
00131     // Other keys
00132     m_reverseKeyTranslateTable[GHOST_kKeyCapsLock              ] = KX_CAPSLOCKKEY              ;                  
00133     m_reverseKeyTranslateTable[GHOST_kKeyEsc                   ] = KX_ESCKEY                   ;                  
00134     m_reverseKeyTranslateTable[GHOST_kKeyTab                   ] = KX_TABKEY                   ;                  
00135     m_reverseKeyTranslateTable[GHOST_kKeySpace                 ] = KX_SPACEKEY                 ;                  
00136     m_reverseKeyTranslateTable[GHOST_kKeyEnter                 ] = KX_RETKEY                   ;                  
00137     m_reverseKeyTranslateTable[GHOST_kKeyBackSpace             ] = KX_BACKSPACEKEY             ;                  
00138     m_reverseKeyTranslateTable[GHOST_kKeySemicolon             ] = KX_SEMICOLONKEY             ;                  
00139     m_reverseKeyTranslateTable[GHOST_kKeyPeriod                ] = KX_PERIODKEY                ;                  
00140     m_reverseKeyTranslateTable[GHOST_kKeyComma                 ] = KX_COMMAKEY                 ;                  
00141     m_reverseKeyTranslateTable[GHOST_kKeyQuote                 ] = KX_QUOTEKEY                 ;                  
00142     m_reverseKeyTranslateTable[GHOST_kKeyAccentGrave           ] = KX_ACCENTGRAVEKEY           ;                  
00143     m_reverseKeyTranslateTable[GHOST_kKeyMinus                 ] = KX_MINUSKEY                 ;                  
00144     m_reverseKeyTranslateTable[GHOST_kKeySlash                 ] = KX_SLASHKEY                 ;                  
00145     m_reverseKeyTranslateTable[GHOST_kKeyBackslash             ] = KX_BACKSLASHKEY             ;                  
00146     m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;                  
00147     m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket           ] = KX_LEFTBRACKETKEY           ;                  
00148     m_reverseKeyTranslateTable[GHOST_kKeyRightBracket          ] = KX_RIGHTBRACKETKEY          ;                  
00149 
00150     // Modifier keys.
00151     m_reverseKeyTranslateTable[GHOST_kKeyLeftControl           ] = KX_LEFTCTRLKEY              ;                  
00152     m_reverseKeyTranslateTable[GHOST_kKeyRightControl          ] = KX_RIGHTCTRLKEY             ;                  
00153     m_reverseKeyTranslateTable[GHOST_kKeyLeftAlt               ] = KX_LEFTALTKEY               ;                  
00154     m_reverseKeyTranslateTable[GHOST_kKeyRightAlt              ] = KX_RIGHTALTKEY              ;                  
00155     m_reverseKeyTranslateTable[GHOST_kKeyLeftShift             ] = KX_LEFTSHIFTKEY             ;                  
00156     m_reverseKeyTranslateTable[GHOST_kKeyRightShift            ] = KX_RIGHTSHIFTKEY            ;                  
00157 }
00158 
00159 
00160 GPG_KeyboardDevice::~GPG_KeyboardDevice(void)
00161 {
00162 }