Changeset 5014 in orxonox.OLD for orxonox/trunk/src/lib/event
- Timestamp:
- Aug 14, 2005, 4:29:29 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib/event
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/event/key_mapper.cc
r4866 r5014 121 121 void KeyMapper::loadKeyBindings(IniParser* iniParser) 122 122 { 123 if( iniParser->getSection (CONFIG_SECTION_PLAYER "1") == -1)123 if( !iniParser->getSection (CONFIG_SECTION_PLAYER "1")) 124 124 { 125 125 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n"); 126 126 return; 127 127 } 128 // allocate empty lookup table129 130 char namebuf[256];131 char valuebuf[256];132 memset (namebuf, 0, 256);133 memset (valuebuf, 0, 256);134 128 int* index; 135 129 136 while( iniParser->nextVar (namebuf, valuebuf) != -1) 137 { 138 PRINTF(3)("Keys: Parsing %s, %s now.\n", namebuf, valuebuf); 139 index = nameToIndex (valuebuf); 140 this->mapKeys(namebuf, index[1]); 141 142 /* 143 switch( index[0]) 144 { 145 case 0: 146 this->mapKeys(namebuf, index[1]); 147 break; 148 case 1: 149 this->mapKeys(namebuf, index[1]); 150 break; 151 default: 152 break; 153 } 154 */ 155 memset (namebuf, 0, 256); 156 memset (valuebuf, 0, 256); 130 while(iniParser->nextVar()) 131 { 132 PRINTF(3)("Keys: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); 133 index = nameToIndex (iniParser->getCurrentValue()); 134 this->mapKeys(iniParser->getCurrentName(), index[1]); 157 135 } 158 136 159 137 160 138 // PARSE MISC SECTION 161 if( iniParser->getSection (CONFIG_SECTION_MISC_KEYS) == -1)162 { 163 PRINTF(1)("Could not find key bindings \n");139 if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS)) 140 { 141 PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n"); 164 142 return; 165 143 } 166 144 167 while( iniParser->nextVar (namebuf, valuebuf) != -1) 168 { 169 PRINTF(3)("MISC: Parsing %s, %s now.\n", namebuf, valuebuf); 170 index = nameToIndex (valuebuf); 171 this->mapKeys(namebuf, index[1]); 172 /* 173 switch( index[0]) 174 { 175 case 0: 176 this->mapKeys(namebuf, index[1]); 177 break; 178 case 1: 179 this->mapKeys(namebuf, index[1]); 180 break; 181 default: 182 break; 183 } 184 */ 185 memset (namebuf, 0, 256); 186 memset (valuebuf, 0, 256); 145 while( iniParser->nextVar()) 146 { 147 PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); 148 index = nameToIndex (iniParser->getCurrentValue()); 149 this->mapKeys(iniParser->getCurrentName(), index[1]); 187 150 } 188 151 } … … 192 155 * @param the name of the button 193 156 */ 194 int* KeyMapper::nameToIndex (c har* name)157 int* KeyMapper::nameToIndex (const char* name) 195 158 { 196 159 coord[0] = -1; … … 216 179 * @param id of the key 217 180 */ 218 void KeyMapper::mapKeys(c har* name, int keyID)181 void KeyMapper::mapKeys(const char* name, int keyID) 219 182 { 220 183 for(int i = 0; map[i].pValue != NULL; ++i ) -
orxonox/trunk/src/lib/event/key_mapper.h
r4866 r5014 35 35 36 36 private: 37 int* nameToIndex (c har* name);38 void mapKeys(c har* name, int keyID);37 int* nameToIndex (const char* name); 38 void mapKeys(const char* name, int keyID); 39 39 40 40 public:
Note: See TracChangeset
for help on using the changeset viewer.