Changeset 1215 for code/branches/input/src/core/InputHandler.cc
- Timestamp:
- May 2, 2008, 9:31:20 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/input/src/core/InputHandler.cc
r1213 r1215 267 267 switch (j) 268 268 { 269 // note: the first element in the struct is the string, so the following pointer 270 // arithmetic works. 269 271 case 0: 270 cont->getValue( bindingsKeyPress_ + i);272 cont->getValue(&bindingsKeyPress_[i].commandStr); 271 273 break; 272 274 case 1: … … 337 339 for (int i = 0; i < numberOfKeys_s; i++) 338 340 { 339 bindingsKeyPress_ [i] = "";340 bindingsKeyRelease_[i] = "";341 bindingsKeyHold_ [i] = "";341 bindingsKeyPress_ [i].commandStr = ""; 342 bindingsKeyRelease_[i].commandStr = ""; 343 bindingsKeyHold_ [i].commandStr = ""; 342 344 } 343 345 for (int i = 0; i < numberOfMouseButtons_s; i++) … … 366 368 setConfigValues(); 367 369 370 // evaluate the key bindings 371 // TODO: what if binding is invalid? 372 //for (int i = 0; i < numberOfKeys_s; i++) 373 //{ 374 // if (bindingsKeyPress_[i].commandStr != "") 375 // { 376 // bindingsKeyPress_[i].evaluation = CommandExecutor::evaluate(bindingsKeyPress_[i].commandStr); 377 // bindingsKeyPress_[i].commandStr = bindingsKeyPress_[i].evaluation.getCommandString(); 378 // } 379 //} 380 368 381 COUT(ORX_DEBUG) << "KeyBinder: Loading key bindings done." << std::endl; 382 return true; 383 } 384 385 bool KeyBinder::executeBinding(KeyBinding& binding) 386 { 387 if (binding.commandStr != "") 388 { 389 //if (binding.commandStr != binding.evaluation.getCommandString()) 390 //{ 391 // // key binding has changed, reevaluate the command string. 392 // binding.evaluation = CommandExecutor::evaluate(binding.commandStr); 393 // binding.commandStr = binding.evaluation.getCommandString(); 394 //} 395 COUT(3) << "Executing command: " << binding.commandStr << std::endl; 396 CommandExecutor::execute(binding.commandStr); 397 } 398 369 399 return true; 370 400 } … … 379 409 COUT(3) << "Key: " << e.key << std::endl; 380 410 // find the appropriate key binding 381 std::string cmdStr = bindingsKeyPress_[int(e.key)]; 382 if (cmdStr != "") 383 { 384 CommandExecutor::execute(cmdStr); 385 COUT(3) << "Executing command: " << cmdStr << std::endl; 386 } 387 411 executeBinding(bindingsKeyPress_[int(e.key)]); 412 388 413 return true; 389 414 } … … 396 421 { 397 422 // find the appropriate key binding 398 std::string cmdStr = bindingsKeyRelease_[int(e.key)]; 399 if (cmdStr != "") 400 { 401 CommandExecutor::execute(cmdStr); 402 COUT(3) << "Executing command: " << cmdStr << std::endl; 403 } 423 executeBinding(bindingsKeyRelease_[int(e.key)]); 404 424 405 425 return true; … … 413 433 { 414 434 // find the appropriate key binding 415 std::string cmdStr = bindingsKeyHold_[int(e.key)]; 416 if (cmdStr != "") 417 { 418 CommandExecutor::execute(cmdStr); 419 COUT(3) << "Executing command: " << cmdStr << std::endl; 420 } 435 executeBinding(bindingsKeyHold_[int(e.key)]); 421 436 422 437 return true; … … 486 501 } 487 502 488 bool KeyBinder::buttonPressed( const OIS::JoyStickEvent &arg, int button)503 bool KeyBinder::buttonPressed(int joyStickID, const OIS::JoyStickEvent &arg, int button) 489 504 { 490 505 // find the appropriate key binding … … 499 514 } 500 515 501 bool KeyBinder::buttonReleased( const OIS::JoyStickEvent &arg, int button)516 bool KeyBinder::buttonReleased(int joyStickID, const OIS::JoyStickEvent &arg, int button) 502 517 { 503 518 // find the appropriate key binding … … 512 527 } 513 528 514 bool KeyBinder::buttonHeld( const OIS::JoyStickEvent &arg, int button)529 bool KeyBinder::buttonHeld(int joyStickID, const OIS::JoyStickEvent &arg, int button) 515 530 { 516 531 // find the appropriate key binding … … 525 540 } 526 541 527 bool KeyBinder::axisMoved(const OIS::JoyStickEvent &arg, int axis) 528 { 529 return true; 530 } 531 532 bool KeyBinder::sliderMoved(const OIS::JoyStickEvent &arg, int id) 533 { 534 return true; 535 } 536 537 bool KeyBinder::povMoved(const OIS::JoyStickEvent &arg, int id) 542 bool KeyBinder::axisMoved(int joyStickID, const OIS::JoyStickEvent &arg, int axis) 543 { 544 return true; 545 } 546 547 bool KeyBinder::sliderMoved(int joyStickID, const OIS::JoyStickEvent &arg, int id) 548 { 549 return true; 550 } 551 552 bool KeyBinder::povMoved(int joyStickID, const OIS::JoyStickEvent &arg, int id) 553 { 554 return true; 555 } 556 557 bool KeyBinder::vector3Moved(int joyStickID, const OIS::JoyStickEvent &arg, int id) 538 558 { 539 559 return true;
Note: See TracChangeset
for help on using the changeset viewer.