Changeset 11052 for code/trunk/src/libraries/core/input/KeyBinder.cc
- Timestamp:
- Jan 9, 2016, 6:26:20 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/input/KeyBinder.cc
r10624 r11052 359 359 /** 360 360 @brief 361 Return the first key name for a specific command in a human readable form 362 */ 363 const std::string& KeyBinder::getBindingReadable(const std::string& commandName) 364 { 365 const std::string& binding = this->getBinding(commandName); 366 367 SubString substring = SubString(binding, "."); 368 std::string name; 369 std::string group; 370 switch(substring.size()) 371 { 372 case 0: 373 return binding; 374 case 1: 375 return binding; 376 case 2: 377 group = substring[0]; 378 default: 379 name = substring.subSet(1).join("."); 380 } 381 382 std::stringstream stream; 383 if(group.compare("Keys") == 0) 384 stream << "Key " << name.substr(3); 385 else if(group.compare("MouseButtons") == 0) 386 stream << "Mouse " << name; 387 else if(group.compare("JoyStickButtons") == 0) 388 stream << "Joystick " << name; 389 else if(group.compare("JoyStickAxes") == 0) 390 stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6); 391 else if(group.compare("MouseAxes") == 0) 392 stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis"; 393 else 394 return binding; 395 396 return *(new std::string(stream.str())); 397 } 398 399 /** 400 @brief 361 401 Get the number of different key bindings of a specific command. 362 402 @param commandName
Note: See TracChangeset
for help on using the changeset viewer.