Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

KX_BlenderInputDevice.h

Go to the documentation of this file.
00001 #ifndef __KX_BLENDERINPUTDEVICE
00002 #define __KX_BLENDERINPUTDEVICE
00003 
00004 /* need to be here for conversion purposes */
00005 #include "mydevice.h"
00006 #include "SCA_IInputDevice.h"
00007 
00008 #include <map>
00012 class BL_BlenderInputDevice : public SCA_IInputDevice                                                               
00013 {
00014         // this map is Blender specific: a conversion between blender and ketsji enums
00015         std::map<int,KX_EnumInputs> m_reverseKeyTranslateTable;
00016 public:
00017         BL_BlenderInputDevice()                                                                                    

00018                 {                                                                                                          
00019                         
00020                         /* The reverse table. In order to not confuse ourselves, we      */
00021                         /* immediately convert all events that come in to KX codes.      */
00022                         m_reverseKeyTranslateTable[LEFTMOUSE                    ] =     KX_LEFTMOUSE            ;                       
00023                         m_reverseKeyTranslateTable[MIDDLEMOUSE                  ] =     KX_MIDDLEMOUSE          ;                       
00024                         m_reverseKeyTranslateTable[RIGHTMOUSE                   ] =     KX_RIGHTMOUSE           ;                       
00025                         m_reverseKeyTranslateTable[MOUSEX                               ] = KX_MOUSEX                   ;                       
00026                         m_reverseKeyTranslateTable[MOUSEY                               ] =     KX_MOUSEY                       ;                       
00027                                                                                                                    
00028                         // TIMERS                                                                                                  
00029 
00030                         m_reverseKeyTranslateTable[TIMER0                           ] = KX_TIMER0                  ;                  
00031                         m_reverseKeyTranslateTable[TIMER1                           ] = KX_TIMER1                  ;                  
00032                         m_reverseKeyTranslateTable[TIMER2                           ] = KX_TIMER2                  ;                  
00033                         m_reverseKeyTranslateTable[TIMER3                           ] = KX_TIMER3                  ;                  
00034                                                                                                                    
00035                         // SYSTEM                                                                                                  
00036                                                                                                                    
00037                         m_reverseKeyTranslateTable[KEYBD                            ] = KX_KEYBD                   ;                  
00038                         m_reverseKeyTranslateTable[RAWKEYBD                         ] = KX_RAWKEYBD                ;                  
00039                         m_reverseKeyTranslateTable[REDRAW                           ] = KX_REDRAW                  ;                  
00040                         m_reverseKeyTranslateTable[INPUTCHANGE                      ] = KX_INPUTCHANGE             ;                  
00041                         m_reverseKeyTranslateTable[QFULL                            ] = KX_QFULL                   ;                  
00042                         m_reverseKeyTranslateTable[WINFREEZE                        ] = KX_WINFREEZE               ;                  
00043                         m_reverseKeyTranslateTable[WINTHAW                          ] = KX_WINTHAW                 ;                  
00044                         m_reverseKeyTranslateTable[WINCLOSE                         ] = KX_WINCLOSE                ;                  
00045                         m_reverseKeyTranslateTable[WINQUIT                          ] = KX_WINQUIT                 ;                  
00046                         m_reverseKeyTranslateTable[Q_FIRSTTIME                      ] = KX_Q_FIRSTTIME             ;                  
00047                                                                                                                    
00048                         // standard keyboard                                                                                       
00049                                                                                                                    
00050                         m_reverseKeyTranslateTable[AKEY                             ] = KX_AKEY                    ;                  
00051                         m_reverseKeyTranslateTable[BKEY                             ] = KX_BKEY                    ;                  
00052                         m_reverseKeyTranslateTable[CKEY                             ] = KX_CKEY                    ;                  
00053                         m_reverseKeyTranslateTable[DKEY                             ] = KX_DKEY                    ;                  
00054                         m_reverseKeyTranslateTable[EKEY                             ] = KX_EKEY                    ;                  
00055                         m_reverseKeyTranslateTable[FKEY                             ] = KX_FKEY                    ;                  
00056                         m_reverseKeyTranslateTable[GKEY                             ] = KX_GKEY                    ;                  
00057                         m_reverseKeyTranslateTable[HKEY                             ] = KX_HKEY                    ;                  
00058                         m_reverseKeyTranslateTable[IKEY                             ] = KX_IKEY                    ;                  
00059                         m_reverseKeyTranslateTable[JKEY                             ] = KX_JKEY                    ;                  
00060                         m_reverseKeyTranslateTable[KKEY                             ] = KX_KKEY                    ;                  
00061                         m_reverseKeyTranslateTable[LKEY                             ] = KX_LKEY                    ;                  
00062                         m_reverseKeyTranslateTable[MKEY                             ] = KX_MKEY                    ;                  
00063                         m_reverseKeyTranslateTable[NKEY                             ] = KX_NKEY                    ;                  
00064                         m_reverseKeyTranslateTable[OKEY                             ] = KX_OKEY                    ;                  
00065                         m_reverseKeyTranslateTable[PKEY                             ] = KX_PKEY                    ;                  
00066                         m_reverseKeyTranslateTable[QKEY                             ] = KX_QKEY                    ;                  
00067                         m_reverseKeyTranslateTable[RKEY                             ] = KX_RKEY                    ;                  
00068                         m_reverseKeyTranslateTable[SKEY                             ] = KX_SKEY                    ;                  
00069                         m_reverseKeyTranslateTable[TKEY                             ] = KX_TKEY                    ;                  
00070                         m_reverseKeyTranslateTable[UKEY                             ] = KX_UKEY                    ;                  
00071                         m_reverseKeyTranslateTable[VKEY                             ] = KX_VKEY                    ;                  
00072                         m_reverseKeyTranslateTable[WKEY                             ] = KX_WKEY                    ;                  
00073                         m_reverseKeyTranslateTable[XKEY                             ] = KX_XKEY                    ;                  
00074                         m_reverseKeyTranslateTable[YKEY                             ] = KX_YKEY                    ;                  
00075                         m_reverseKeyTranslateTable[ZKEY                             ] = KX_ZKEY                    ;                  
00076                                                                                                                    
00077                         m_reverseKeyTranslateTable[ZEROKEY                              ] = KX_ZEROKEY                  ;                  
00078                         m_reverseKeyTranslateTable[ONEKEY                               ] = KX_ONEKEY                   ;                  
00079                         m_reverseKeyTranslateTable[TWOKEY                               ] = KX_TWOKEY                   ;                  
00080                         m_reverseKeyTranslateTable[THREEKEY                     ] = KX_THREEKEY                ;                  
00081                         m_reverseKeyTranslateTable[FOURKEY                              ] = KX_FOURKEY                  ;                  
00082                         m_reverseKeyTranslateTable[FIVEKEY                              ] = KX_FIVEKEY                  ;                  
00083                         m_reverseKeyTranslateTable[SIXKEY                               ] = KX_SIXKEY                   ;                  
00084                         m_reverseKeyTranslateTable[SEVENKEY                         ] = KX_SEVENKEY                ;                  
00085                         m_reverseKeyTranslateTable[EIGHTKEY                         ] = KX_EIGHTKEY                ;                  
00086                         m_reverseKeyTranslateTable[NINEKEY                              ] = KX_NINEKEY                  ;                  
00087                                                                                                                    
00088                         m_reverseKeyTranslateTable[CAPSLOCKKEY                      ] = KX_CAPSLOCKKEY             ;                  
00089                                                                 
00090                         m_reverseKeyTranslateTable[LEFTCTRLKEY                  ] = KX_LEFTCTRLKEY              ;                  
00091                         m_reverseKeyTranslateTable[LEFTALTKEY                   ] = KX_LEFTALTKEY               ;                  
00092                         m_reverseKeyTranslateTable[RIGHTALTKEY                  ] = KX_RIGHTALTKEY              ;                  
00093                         m_reverseKeyTranslateTable[RIGHTCTRLKEY                         ] = KX_RIGHTCTRLKEY             ;                  
00094                         m_reverseKeyTranslateTable[RIGHTSHIFTKEY                        ] = KX_RIGHTSHIFTKEY            ;                  
00095                         m_reverseKeyTranslateTable[LEFTSHIFTKEY                     ] = KX_LEFTSHIFTKEY            ;                  
00096                                                                                                                    
00097                         m_reverseKeyTranslateTable[ESCKEY                           ] = KX_ESCKEY                  ;                  
00098                         m_reverseKeyTranslateTable[TABKEY                           ] = KX_TABKEY                  ;                  
00099                         m_reverseKeyTranslateTable[RETKEY                           ] = KX_RETKEY                  ;                  
00100                         m_reverseKeyTranslateTable[SPACEKEY                         ] = KX_SPACEKEY                ;                  
00101                         m_reverseKeyTranslateTable[LINEFEEDKEY                  ] = KX_LINEFEEDKEY              ;                  
00102                         m_reverseKeyTranslateTable[BACKSPACEKEY                     ] = KX_BACKSPACEKEY            ;                  
00103                         m_reverseKeyTranslateTable[DELKEY                           ] = KX_DELKEY                  ;                  
00104                         m_reverseKeyTranslateTable[SEMICOLONKEY                     ] = KX_SEMICOLONKEY            ;                  
00105                         m_reverseKeyTranslateTable[PERIODKEY                    ] = KX_PERIODKEY                ;                  
00106                         m_reverseKeyTranslateTable[COMMAKEY                             ] = KX_COMMAKEY         ;                  
00107                         m_reverseKeyTranslateTable[QUOTEKEY                             ] = KX_QUOTEKEY         ;                  
00108                         m_reverseKeyTranslateTable[ACCENTGRAVEKEY                       ] = KX_ACCENTGRAVEKEY           ;                  
00109                         m_reverseKeyTranslateTable[MINUSKEY                             ] = KX_MINUSKEY         ;                  
00110                         m_reverseKeyTranslateTable[VIRGULEKEY                   ] = KX_VIRGULEKEY               ;                  
00111                         m_reverseKeyTranslateTable[SLASHKEY                             ] = KX_SLASHKEY         ;                  
00112                         m_reverseKeyTranslateTable[BACKSLASHKEY                     ] = KX_BACKSLASHKEY            ;                  
00113                         m_reverseKeyTranslateTable[EQUALKEY                             ] = KX_EQUALKEY         ;                  
00114                         m_reverseKeyTranslateTable[LEFTBRACKETKEY                       ] = KX_LEFTBRACKETKEY           ;                  
00115                         m_reverseKeyTranslateTable[RIGHTBRACKETKEY                      ] = KX_RIGHTBRACKETKEY          ;                  
00116                                                                                                                    
00117                         m_reverseKeyTranslateTable[LEFTARROWKEY                     ] = KX_LEFTARROWKEY            ;                  
00118                         m_reverseKeyTranslateTable[DOWNARROWKEY                     ] = KX_DOWNARROWKEY            ;                  
00119                         m_reverseKeyTranslateTable[RIGHTARROWKEY                        ] = KX_RIGHTARROWKEY            ;                  
00120                         m_reverseKeyTranslateTable[UPARROWKEY                   ] = KX_UPARROWKEY               ;                  
00121                                                                                                                    
00122                         m_reverseKeyTranslateTable[PAD2                         ] = KX_PAD2                     ;                  
00123                         m_reverseKeyTranslateTable[PAD4                         ] = KX_PAD4                     ;                  
00124                         m_reverseKeyTranslateTable[PAD6                         ] = KX_PAD6                     ;                  
00125                         m_reverseKeyTranslateTable[PAD8                         ] = KX_PAD8                     ;                  
00126                                                                                                                    
00127                         m_reverseKeyTranslateTable[PAD1                         ] = KX_PAD1                     ;                  
00128                         m_reverseKeyTranslateTable[PAD3                         ] = KX_PAD3                     ;                  
00129                         m_reverseKeyTranslateTable[PAD5                         ] = KX_PAD5                     ;                  
00130                         m_reverseKeyTranslateTable[PAD7                         ] = KX_PAD7                     ;                  
00131                         m_reverseKeyTranslateTable[PAD9                         ] = KX_PAD9                     ;                  
00132 
00133                         m_reverseKeyTranslateTable[PADPERIOD                        ] = KX_PADPERIOD               ;                  
00134                         m_reverseKeyTranslateTable[PADVIRGULEKEY                    ] = KX_PADVIRGULEKEY           ;                  
00135                         m_reverseKeyTranslateTable[PADASTERKEY                      ] = KX_PADASTERKEY             ;                  
00136                                                                                                                    
00137                                                                                                                    
00138                         m_reverseKeyTranslateTable[PAD0                         ] = KX_PAD0                     ;                  
00139                         m_reverseKeyTranslateTable[PADMINUS                         ] = KX_PADMINUS                ;                  
00140                         m_reverseKeyTranslateTable[PADENTER                         ] = KX_PADENTER                ;                  
00141                         m_reverseKeyTranslateTable[PADPLUSKEY                       ] = KX_PADPLUSKEY              ;                  
00142                                                                                                                    
00143                                                                                                                    
00144                         m_reverseKeyTranslateTable[F1KEY                            ] = KX_F1KEY                   ;                  
00145                         m_reverseKeyTranslateTable[F2KEY                            ] = KX_F2KEY                   ;                  
00146                         m_reverseKeyTranslateTable[F3KEY                            ] = KX_F3KEY                   ;                  
00147                         m_reverseKeyTranslateTable[F4KEY                            ] = KX_F4KEY                   ;                  
00148                         m_reverseKeyTranslateTable[F5KEY                            ] = KX_F5KEY                   ;                  
00149                         m_reverseKeyTranslateTable[F6KEY                            ] = KX_F6KEY                   ;                  
00150                         m_reverseKeyTranslateTable[F7KEY                            ] = KX_F7KEY                   ;                  
00151                         m_reverseKeyTranslateTable[F8KEY                            ] = KX_F8KEY                   ;                  
00152                         m_reverseKeyTranslateTable[F9KEY                            ] = KX_F9KEY                   ;                  
00153                         m_reverseKeyTranslateTable[F10KEY                           ] = KX_F10KEY                  ;                  
00154                         m_reverseKeyTranslateTable[F11KEY      ] = KX_F11KEY                  ;                  
00155                         m_reverseKeyTranslateTable[F12KEY      ] = KX_F12KEY                  ;                  
00156                                                                                                                    
00157                         m_reverseKeyTranslateTable[PAUSEKEY    ] = KX_PAUSEKEY                ;                  
00158                         m_reverseKeyTranslateTable[INSERTKEY   ] = KX_INSERTKEY               ;                  
00159                         m_reverseKeyTranslateTable[HOMEKEY     ] = KX_HOMEKEY                 ;                  
00160                         m_reverseKeyTranslateTable[PAGEUPKEY   ] = KX_PAGEUPKEY               ;                  
00161                         m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY             ;                  
00162                         m_reverseKeyTranslateTable[ENDKEY      ] = KX_ENDKEY                  ;                  
00163 
00164                                                                                                                    
00165                 }                                                                                                          
00166 
00167         virtual ~BL_BlenderInputDevice()

00168                 {
00169 
00170                 }
00171                                                                                                                    
00172          KX_EnumInputs ToNative(unsigned short incode) {
00173                 return m_reverseKeyTranslateTable[incode];
00174         }
00175 
00176         virtual bool    IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
00177 //      virtual const SCA_InputEvent&   GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
00178         virtual bool    ConvertBlenderEvent(unsigned short incode,short val)=0;
00179 
00180 };                                                                                                                 
00181 
00182 
00183                                                                                                                    
00184 
00185 
00186 #endif //__KX_BLENDERINPUTDEVICE

Generated at Thu Feb 1 13:03:03 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000