- Timestamp:
- May 30, 2005, 6:12:24 PM (19 years ago)
- Location:
- orxonox/trunk/src/util/event
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/event/key_mapper.cc
r4401 r4402 130 130 PRINTF(3)("Key binding %d(%s) set to %s\n", index[1], SDLKToKeyname( index[1]), namebuf); 131 131 strcpy (this->keyAliases->keys[index[1]], namebuf); 132 this->mapKeys(namebuf, index[1]); 132 133 break; 133 134 case 1: … … 171 172 memset (valuebuf, 0, 256); 172 173 } 173 this->mapKeys();174 174 } 175 175 … … 196 196 197 197 198 void KeyMapper::mapKeys() 199 { 200 for(int i = 0; i < N_STD_KEYS; ++i) 201 { 202 if( !strcmp (this->keyAliases->keys[i], "Up")) PEV_UP = i; 203 204 } 205 PRINTF(0)("fire = %i\n", PEV_FIRE1); 198 void KeyMapper::mapKeys(char* name, int keyID) 199 { 200 for(int i = 0; map[i].pValue != NULL; ++i ) 201 { 202 if( !strcmp (name, map[i].pName)) { *map[i].pValue = keyID; break;} 203 } 206 204 } 207 205 … … 210 208 { 211 209 //PRINT(0)("\n==========================| KeyMapper::debug() |===\n"); 212 PRINT(0)(" Command 'up' got SDL key-ref nr %i \n", keynameToSDLK("UP"));213 PRINT(0)(" Command 'down' got SDL key-ref nr %i \n", (this->nameToIndex("DOWN"))[1]);214 PRINT(0)(" Command 'right' got SDL key-ref nr %i \n", (this->nameToIndex("RIGHT"))[1]);215 PRINT(0)(" Command 'left' got SDL key-ref nr %i \n", (this->nameToIndex("LEFT"))[1]);210 PRINT(0)("PEV_UP = %i\n", PEV_UP); 211 PRINT(0)("PEV_DOWN = %i\n", PEV_DOWN); 212 PRINT(0)("PEV_LEFT = %i\n", PEV_LEFT); 213 PRINT(0)("PEV_RIGHT = %i\n", PEV_RIGHT); 216 214 217 215 //PRINT(0)("=======================================================\n"); -
orxonox/trunk/src/util/event/key_mapper.h
r4401 r4402 28 28 { 29 29 int* pValue; 30 char* name;30 char* pName; 31 31 }; 32 32 … … 45 45 private: 46 46 int* nameToIndex (char* name); 47 void mapKeys( );47 void mapKeys(char* name, int keyID); 48 48 49 49 public:
Note: See TracChangeset
for help on using the changeset viewer.