00001
00006
00007 #ifndef __SDLINPUTDEVICE_H
00008 #define __SDLINPUTDEVICE_H
00009
00010
00011 #include <map>
00012
00013 #include <SDL/SDL.h>
00014
00015 #include "SCA_IInputDevice.h"
00016
00017
00018 class SDLInputDevice : public SCA_IInputDevice
00019 {
00020
00021 std::map<int,KX_EnumInputs> m_reverseKeyTranslateTable;
00022
00023 public:
00024 SDLInputDevice()
00025 {
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 m_reverseKeyTranslateTable[SDLK_a ] = KX_AKEY ;
00054 m_reverseKeyTranslateTable[SDLK_b ] = KX_BKEY ;
00055 m_reverseKeyTranslateTable[SDLK_c ] = KX_CKEY ;
00056 m_reverseKeyTranslateTable[SDLK_d ] = KX_DKEY ;
00057 m_reverseKeyTranslateTable[SDLK_e ] = KX_EKEY ;
00058 m_reverseKeyTranslateTable[SDLK_f ] = KX_FKEY ;
00059 m_reverseKeyTranslateTable[SDLK_g ] = KX_GKEY ;
00060 m_reverseKeyTranslateTable[SDLK_h ] = KX_HKEY ;
00061 m_reverseKeyTranslateTable[SDLK_i ] = KX_IKEY ;
00062 m_reverseKeyTranslateTable[SDLK_j ] = KX_JKEY ;
00063 m_reverseKeyTranslateTable[SDLK_k ] = KX_KKEY ;
00064 m_reverseKeyTranslateTable[SDLK_l ] = KX_LKEY ;
00065 m_reverseKeyTranslateTable[SDLK_m ] = KX_MKEY ;
00066 m_reverseKeyTranslateTable[SDLK_n ] = KX_NKEY ;
00067 m_reverseKeyTranslateTable[SDLK_o ] = KX_OKEY ;
00068 m_reverseKeyTranslateTable[SDLK_p ] = KX_PKEY ;
00069 m_reverseKeyTranslateTable[SDLK_q ] = KX_QKEY ;
00070 m_reverseKeyTranslateTable[SDLK_r ] = KX_RKEY ;
00071 m_reverseKeyTranslateTable[SDLK_s ] = KX_SKEY ;
00072 m_reverseKeyTranslateTable[SDLK_t ] = KX_TKEY ;
00073 m_reverseKeyTranslateTable[SDLK_u ] = KX_UKEY ;
00074 m_reverseKeyTranslateTable[SDLK_v ] = KX_VKEY ;
00075 m_reverseKeyTranslateTable[SDLK_w ] = KX_WKEY ;
00076 m_reverseKeyTranslateTable[SDLK_x ] = KX_XKEY ;
00077 m_reverseKeyTranslateTable[SDLK_y ] = KX_YKEY ;
00078 m_reverseKeyTranslateTable[SDLK_z ] = KX_ZKEY ;
00079 m_reverseKeyTranslateTable[SDLK_ESCAPE ] = KX_ESCKEY ;
00080
00081 };
00082 virtual ~SDLInputDevice () {};
00083
00084 virtual unsigned short Translate(KX_EnumInputs incode) {
00085 return 0;
00086 };
00087
00088 virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)
00089 {
00090 return false;
00091 }
00092
00093
00094
00095
00096
00097
00098 KX_EnumInputs ToNative(SDLKey incode)
00099 {
00100 return m_reverseKeyTranslateTable[incode];
00101 }
00102
00103 virtual bool ConvertSDLEvent(SDLKey incode, int val) = 0;
00104 };
00105
00106 #endif //__SDLINPUTDEVICE_H