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

KX_GlutInputDevice.h

Go to the documentation of this file.
00001 #ifndef __KX_GLUTINPUTDEVICE_H
00002 #define __KX_GLUTINPUTDEVICE_H
00003 #ifdef WIN32
00004 #pragma warning (disable : 4786)
00005 #endif //WIN32
00006 
00007 #include "SCA_IInputDevice.h"
00008 // for keyboard definitions
00009 #include <GL/glut.h>
00010 #include <map>
00011 class KX_GlutInputDevice : public SCA_IInputDevice
00012 {
00013         // this map is Glut specific: a conversion between Glut and ketsji enums
00014         std::map<int,KX_EnumInputs> m_reverseKeyTranslateTable;
00015 
00016 public:
00017         KX_GlutInputDevice() {
00018                 /* The reverse table. In order to not confuse ourselves, we      */
00019                         /* immediately convert all events that come in to KX codes.      */
00020                         m_reverseKeyTranslateTable[GLUT_LEFT_BUTTON                     ] =     KX_LEFTMOUSE            ;                       
00021                         m_reverseKeyTranslateTable[GLUT_MIDDLE_BUTTON   ] =     KX_MIDDLEMOUSE          ;                       
00022                         m_reverseKeyTranslateTable[GLUT_RIGHT_BUTTON] = KX_RIGHTMOUSE           ;                       
00023                         //m_reverseKeyTranslateTable[MOUSEX                             ] = KX_MOUSEX                   ;                       
00024                         //m_reverseKeyTranslateTable[MOUSEY                             ] =     KX_MOUSEY                       ;                       
00025                                                                                                                    
00026                         // TIMERS                                                                                                  
00027 
00028                         //m_reverseKeyTranslateTable[TIMER0                           ] =       KX_TIMER0                  ;                  
00029                         //m_reverseKeyTranslateTable[TIMER1                           ] =       KX_TIMER1                  ;                  
00030                         //m_reverseKeyTranslateTable[TIMER2                           ] = KX_TIMER2                  ;                  
00031                         //m_reverseKeyTranslateTable[TIMER3                           ] = KX_TIMER3                  ;                  
00032                                                                                                                    
00033                         // SYSTEM                                                                                                  
00034                                                                                                                    
00035                         //m_reverseKeyTranslateTable[KEYBD                            ] = KX_KEYBD                   ;                  
00036                         //m_reverseKeyTranslateTable[RAWKEYBD                         ] = KX_RAWKEYBD                ;                  
00037                         //m_reverseKeyTranslateTable[REDRAW                           ] = KX_REDRAW                  ;                  
00038                         //m_reverseKeyTranslateTable[INPUTCHANGE                      ] = KX_INPUTCHANGE             ;                  
00039                         //m_reverseKeyTranslateTable[QFULL                            ] = KX_QFULL                   ;                  
00040                         //m_reverseKeyTranslateTable[WINFREEZE                        ] = KX_WINFREEZE               ;                  
00041                         //m_reverseKeyTranslateTable[WINTHAW                          ] = KX_WINTHAW                 ;                  
00042                         //m_reverseKeyTranslateTable[WINCLOSE                         ] = KX_WINCLOSE                ;                  
00043                         //m_reverseKeyTranslateTable[WINQUIT                          ] = KX_WINQUIT                 ;                  
00044                         //m_reverseKeyTranslateTable[Q_FIRSTTIME                      ] = KX_Q_FIRSTTIME             ;                  
00045                                                                                                                    
00046                         // standard keyboard                                                                                       
00047                                                                                                                    
00048                         
00049                         m_reverseKeyTranslateTable['a'                            ] = KX_AKEY                    ;                  
00050                         m_reverseKeyTranslateTable['b'                            ] = KX_BKEY                    ;                  
00051                         m_reverseKeyTranslateTable['c'                             ] = KX_CKEY                    ;                  
00052                         m_reverseKeyTranslateTable['d'                             ] = KX_DKEY                    ;                  
00053                         m_reverseKeyTranslateTable[101                             ] = KX_EKEY                    ;                  
00054                         m_reverseKeyTranslateTable['f'                             ] = KX_FKEY                    ;                  
00055                         m_reverseKeyTranslateTable['g'                             ] = KX_GKEY                    ;                  
00056                         m_reverseKeyTranslateTable['h'                             ] = KX_HKEY                    ;                  
00057                         m_reverseKeyTranslateTable['i'                             ] = KX_IKEY                    ;                  
00058                         m_reverseKeyTranslateTable['j'                             ] = KX_JKEY                    ;                  
00059                         m_reverseKeyTranslateTable['k'                             ] = KX_KKEY                    ;                  
00060                         m_reverseKeyTranslateTable['l'                             ] = KX_LKEY                    ;                  
00061                         m_reverseKeyTranslateTable['m'                             ] = KX_MKEY                    ;                  
00062                         m_reverseKeyTranslateTable['n'                             ] = KX_NKEY                    ;                  
00063                         m_reverseKeyTranslateTable['o'                             ] = KX_OKEY                    ;                  
00064                         m_reverseKeyTranslateTable['p'                             ] = KX_PKEY                    ;                  
00065                         m_reverseKeyTranslateTable['q'                             ] = KX_QKEY                    ;                  
00066                         m_reverseKeyTranslateTable['r'                             ] = KX_RKEY                    ;                  
00067                         m_reverseKeyTranslateTable['s'                             ] = KX_SKEY                    ;                  
00068                         m_reverseKeyTranslateTable['t'                             ] =  KX_TKEY                    ;                  
00069                         m_reverseKeyTranslateTable['u'                             ] = KX_UKEY                    ;                  
00070                         m_reverseKeyTranslateTable['v'                             ] = KX_VKEY                    ;                  
00071                         m_reverseKeyTranslateTable['w'                             ] = KX_WKEY                    ;                  
00072                         m_reverseKeyTranslateTable['x'                             ] = KX_XKEY                    ;                  
00073                         m_reverseKeyTranslateTable['y'                             ] = KX_YKEY                    ;                  
00074                         m_reverseKeyTranslateTable['z'                             ] = KX_ZKEY                    ;                  
00075                                                                                                                    
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                   
00118                         /*
00119                         m_reverseKeyTranslateTable[GLUT_KEY_LEFT                                        ] = KX_LEFTARROWKEY            ;                  

00120                         m_reverseKeyTranslateTable[GLUT_KEY_UP                                          ] = KX_DOWNARROWKEY            ;                  

00121                         m_reverseKeyTranslateTable[GLUT_KEY_RIGHT                                       ] = KX_RIGHTARROWKEY            ;                  

00122                         m_reverseKeyTranslateTable[GLUT_KEY_UP                  ] = KX_UPARROWKEY               ;                  

00123               */
00124 
00125                         /*
00126                         m_reverseKeyTranslateTable[PAD2                         ] = KX_PAD2                     ;                  

00127                         m_reverseKeyTranslateTable[PAD4                         ] = KX_PAD4                     ;                  

00128                         m_reverseKeyTranslateTable[PAD6                         ] = KX_PAD6                     ;                  

00129                         m_reverseKeyTranslateTable[PAD8                         ] = KX_PAD8                     ;                  

00130                                                                                                                    

00131                         m_reverseKeyTranslateTable[PAD1                         ] = KX_PAD1                     ;                  

00132                         m_reverseKeyTranslateTable[PAD3                         ] = KX_PAD3                     ;                  

00133                         m_reverseKeyTranslateTable[PAD5                         ] = KX_PAD5                     ;                  

00134                         m_reverseKeyTranslateTable[PAD7                         ] = KX_PAD7                     ;                  

00135                         m_reverseKeyTranslateTable[PAD9                         ] = KX_PAD9                     ;                  

00136 
00137                         m_reverseKeyTranslateTable[PADPERIOD                        ] = KX_PADPERIOD               ;                  

00138                         m_reverseKeyTranslateTable[PADVIRGULEKEY                    ] = KX_PADVIRGULEKEY           ;                  

00139                         m_reverseKeyTranslateTable[PADASTERKEY                      ] = KX_PADASTERKEY             ;                  

00140                                                                                                                    

00141                                                                                                                    

00142                         m_reverseKeyTranslateTable[PAD0                         ] = KX_PAD0                     ;                  

00143                         m_reverseKeyTranslateTable[PADMINUS                         ] = KX_PADMINUS                ;                  

00144                         m_reverseKeyTranslateTable[PADENTER                         ] = KX_PADENTER                ;                  

00145                         m_reverseKeyTranslateTable[PADPLUSKEY                       ] = KX_PADPLUSKEY              ;                  

00146                                                                                                                    

00147                                                                                                                    

00148                         m_reverseKeyTranslateTable[F1KEY                            ] = KX_F1KEY                   ;                  

00149                         m_reverseKeyTranslateTable[F2KEY                            ] = KX_F2KEY                   ;                  

00150                         m_reverseKeyTranslateTable[F3KEY                            ] = KX_F3KEY                   ;                  

00151                         m_reverseKeyTranslateTable[F4KEY                            ] = KX_F4KEY                   ;                  

00152                         m_reverseKeyTranslateTable[F5KEY                            ] = KX_F5KEY                   ;                  

00153                         m_reverseKeyTranslateTable[F6KEY                            ] = KX_F6KEY                   ;                  

00154                         m_reverseKeyTranslateTable[F7KEY                            ] = KX_F7KEY                   ;                  

00155                         m_reverseKeyTranslateTable[F8KEY                            ] = KX_F8KEY                   ;                  

00156                         m_reverseKeyTranslateTable[F9KEY                            ] = KX_F9KEY                   ;                  

00157                         m_reverseKeyTranslateTable[F10KEY                           ] = KX_F10KEY                  ;                  

00158                         m_reverseKeyTranslateTable[F11KEY      ] = KX_F11KEY                  ;                  

00159                         m_reverseKeyTranslateTable[F12KEY      ] = KX_F12KEY                  ;                  

00160                                                                                                                    

00161                         m_reverseKeyTranslateTable[PAUSEKEY    ] = KX_PAUSEKEY                ;                  

00162                         m_reverseKeyTranslateTable[INSERTKEY   ] = KX_INSERTKEY               ;                  

00163                         m_reverseKeyTranslateTable[HOMEKEY     ] = KX_HOMEKEY                 ;                  

00164                         m_reverseKeyTranslateTable[PAGEUPKEY   ] = KX_PAGEUPKEY               ;                  

00165                         m_reverseKeyTranslateTable[PAGEDOWNKEY ] = KX_PAGEDOWNKEY             ;                  

00166                         

00167                         m_reverseKeyTranslateTable[ENDKEY      ] = KX_ENDKEY                  ;                  

00168                         */
00169         
00170         };
00171         virtual ~KX_GlutInputDevice () {
00172         };
00173 
00174 /*      virtual const SCA_InputEvent&   GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)

00175         {

00176                 return m_eventStatusTables[m_currentTable][inputcode];

00177         }

00178         */
00179 
00180         virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)

00181         {
00182                 return false;
00183         }
00184 
00185 
00186 
00187          KX_EnumInputs ToNative(int incode) {
00188                 return m_reverseKeyTranslateTable[incode];
00189         }
00190 
00191         virtual bool    ConvertGlutEvent(int incode,int val)=0;
00192 };
00193 
00194 #endif //__KX_GLUTINPUTDEVICE_H

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