Changeset 4866 in orxonox.OLD for orxonox/trunk/src/lib/event/key_mapper.cc
- Timestamp:
- Jul 14, 2005, 10:38:21 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/event/key_mapper.cc
r4864 r4866 115 115 void KeyMapper::loadKeyBindings (const char* fileName) 116 116 { 117 FILE* stream;118 119 PRINTF(4)("Loading key bindings from %s\n", fileName);120 121 // create parser122 117 IniParser parser(fileName); 123 if( parser.getSection (CONFIG_SECTION_PLAYER "1") == -1) 124 { 125 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1 in %s\n", fileName); 126 return; 127 } 118 this->loadKeyBindings(&parser); 119 } 120 121 void KeyMapper::loadKeyBindings(IniParser* iniParser) 122 { 123 if( iniParser->getSection (CONFIG_SECTION_PLAYER "1") == -1) 124 { 125 PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n"); 126 return; 127 } 128 128 // allocate empty lookup table 129 129 … … 134 134 int* index; 135 135 136 while( parser.nextVar (namebuf, valuebuf) != -1)137 138 139 140 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 141 142 142 /* 143 144 145 146 147 148 149 150 151 152 153 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 154 */ 155 156 157 155 memset (namebuf, 0, 256); 156 memset (valuebuf, 0, 256); 157 } 158 158 159 159 160 160 // PARSE MISC SECTION 161 if( parser.getSection (CONFIG_SECTION_MISC_KEYS) == -1)162 163 PRINTF(1)("Could not find key bindings in %s\n", fileName);164 165 166 167 while( parser.nextVar (namebuf, valuebuf) != -1)168 169 170 171 161 if( iniParser->getSection (CONFIG_SECTION_MISC_KEYS) == -1) 162 { 163 PRINTF(1)("Could not find key bindings\n"); 164 return; 165 } 166 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 172 /* 173 174 175 176 177 178 179 180 181 182 183 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 184 */ 185 memset (namebuf, 0, 256); 186 memset (valuebuf, 0, 256); 187 } 188 } 189 185 memset (namebuf, 0, 256); 186 memset (valuebuf, 0, 256); 187 } 188 } 190 189 191 190 /**
Note: See TracChangeset
for help on using the changeset viewer.