00001
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #pragma once
00033
00034 #include <iostream>
00035 #include <map>
00036 using namespace std;
00037 #include "K3dKeyboard.h"
00038 #include "../System/K3dString.h"
00039 #include "../System/GameData/K3dGameData.h"
00040
00041 enum EKeyMapAction
00042 {
00043 K_GO_FORWARD=0,
00044 K_GO_BACKWARD,
00045 K_GO_UP,
00046 K_GO_DOWN,
00047 K_STRAFE_LEFT,
00048 K_STRAFE_RIGHT,
00049 K_LURCH_LEFT,
00050 K_LURCH_RIGHT,
00051 K_TURN_LEFT,
00052 K_TURN_RIGHT,
00053 K_TURN_UP,
00054 K_TURN_DOWN,
00055 K_NUM_ACTION
00056 };
00057
00058 typedef std::map<EKeyMapAction, int> TKeyMap;
00059
00060 class K3dKeyMap: public K3dKeyboard
00061 {
00062 K3dGameData *m_pGameData;
00063 TKeyMap m_tKeyMap;
00064 public:
00065 K3dKeyMap ( K3dGameData *_pGameData );
00066 ~K3dKeyMap();
00067
00069 void InsertKeyMap ( EKeyMapAction _eAction, int _iSDLKey )
00070 {
00071 m_tKeyMap.insert ( pair<EKeyMapAction, int> ( _eAction, _iSDLKey ) );
00072 }
00073 bool IsKeyPressed ( EKeyMapAction _eKey );
00074
00076 void DeleteKeyMap()
00077 {
00078 m_tKeyMap.clear();
00079 }
00080 EKeyMapAction FindKeyMapAction ( const int _iVal );
00081
00084 int FindMapValue ( EKeyMapAction _eAction )
00085 {
00086 return m_tKeyMap[_eAction];
00087 }
00088 };