Changeset 7636 in orxonox.OLD for branches/qt_gui/src/lib/event
- Timestamp:
- May 17, 2006, 10:50:16 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/qt_gui/src/lib/event/key_mapper.cc
r7635 r7636 138 138 void KeyMapper::loadKeyBindings(IniParser* iniParser) 139 139 { 140 if( !iniParser->getSection (CONFIG_SECTION_ PLAYER "1"))141 { 142 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_ PLAYER"1\n");140 if( !iniParser->getSection (CONFIG_SECTION_CONTROL)) 141 { 142 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n"); 143 143 return; 144 144 } … … 158 158 159 159 // PARSE MISC SECTION 160 if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS)) 161 { 162 PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n"); 160 // if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS)) 161 // { 162 // PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n"); 163 // return; 164 // } 165 // 166 // iniParser->firstVar(); 167 // while( iniParser->getCurrentName() != "" ) 168 // { 169 // PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); 170 // index = nameToIndex (iniParser->getCurrentValue()); 171 // this->mapKeys(iniParser->getCurrentName(), index); 172 // iniParser->nextVar(); 173 // } 174 } 175 176 void KeyMapper::loadKeyBindings() 177 { 178 if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_CONTROL)) 179 { 180 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n"); 163 181 return; 164 182 } 165 166 iniParser->firstVar();167 while( iniParser->getCurrentName() != "" )168 {169 PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());170 index = nameToIndex (iniParser->getCurrentValue());171 this->mapKeys(iniParser->getCurrentName(), index);172 iniParser->nextVar();173 }174 }175 176 void KeyMapper::loadKeyBindings()177 {178 if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))179 {180 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");181 return;182 }183 183 int* index; 184 184 185 std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_ PLAYER "1");185 std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_CONTROL); 186 186 for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ ) 187 187 { 188 PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_ PLAYER "1", *it, "").c_str());188 PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "").c_str()); 189 189 // map the name to an sdl index 190 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_ PLAYER "1", *it, ""));190 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "")); 191 191 // map the index to a internal name 192 this->mapKeys(*it, index);193 }194 195 196 // PARSE MISC SECTION197 if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))198 {199 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");200 return;201 }202 203 keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);204 for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )205 {206 PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());207 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));208 192 this->mapKeys(*it, index); 209 193 }
Note: See TracChangeset
for help on using the changeset viewer.