Changeset 7256 in orxonox.OLD for trunk/src/lib/event
- Timestamp:
- Mar 30, 2006, 11:45:31 AM (19 years ago)
- Location:
- trunk/src/lib/event
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/event/event_handler.cc
r7166 r7256 88 88 * this has to be called before the use of the event handler 89 89 */ 90 void EventHandler::init( IniParser* iniParser)90 void EventHandler::init() 91 91 { 92 92 if (this->keyMapper == NULL) 93 93 { 94 94 this->keyMapper = new KeyMapper(); 95 this->keyMapper->loadKeyBindings( iniParser);95 this->keyMapper->loadKeyBindings(); 96 96 } 97 97 } -
trunk/src/lib/event/event_handler.h
r7164 r7256 15 15 // FORWARD DECLARATION 16 16 class EventListener; 17 class IniParser;18 17 19 18 //! The one Event Handler from Orxonox … … 24 23 /** @returns a Pointer to the only object of this Class */ 25 24 inline static EventHandler* getInstance() { if (!singletonRef) singletonRef = new EventHandler(); return singletonRef; }; 26 void init( IniParser* iniParser);25 void init(); 27 26 28 27 /** @param state: to which the event handler shall change */ -
trunk/src/lib/event/key_mapper.cc
r7221 r7256 25 25 #include "globals.h" 26 26 #include "parser/ini_parser/ini_parser.h" 27 #include "util/preferences.h" 27 28 #include "key_names.h" 28 29 #include "debug.h" … … 145 146 146 147 iniParser->firstVar(); 147 while( iniParser->getCurrentName() != "")148 while( iniParser->getCurrentName() != "" ) 148 149 { 149 150 PRINTF(3)("Keys: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); … … 164 165 165 166 iniParser->firstVar(); 166 while( iniParser->getCurrentName() != "")167 while( iniParser->getCurrentName() != "" ) 167 168 { 168 169 PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue()); … … 170 171 this->mapKeys(iniParser->getCurrentName(), index); 171 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 int* index; 184 185 std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_PLAYER "1"); 186 for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ ) 187 { 188 PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "").c_str()); 189 // map the name to an sdl index 190 index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "")); 191 // map the index to a internal name 192 this->mapKeys(*it, index); 193 } 194 195 196 // PARSE MISC SECTION 197 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 this->mapKeys(*it, index); 172 209 } 173 210 } -
trunk/src/lib/event/key_mapper.h
r7221 r7256 29 29 virtual ~KeyMapper(); 30 30 31 void loadKeyBindings(const std::string& fileName = "" ); 31 void loadKeyBindings(const std::string& fileName ); 32 void loadKeyBindings(); 32 33 void loadKeyBindings(IniParser* iniParser); 33 34
Note: See TracChangeset
for help on using the changeset viewer.