Changeset 1495 for code/branches/network/src/core/InputManager.cc
- Timestamp:
- Jun 1, 2008, 1:10:46 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/core/InputManager.cc
r1494 r1495 41 41 #include "KeyBinder.h" 42 42 #include "CommandExecutor.h" 43 #include "ConsoleCommand.h"#include "Shell.h" 43 #include "ConsoleCommand.h" 44 #include "Shell.h" 45 44 46 namespace orxonox 45 47 { … … 150 152 addKeyHandler(buffer_, "buffer"); 151 153 Shell::getInstance().setInputBuffer(buffer_); 154 152 155 keyBinder_ = new KeyBinder(); 153 156 keyBinder_->loadBindings(); … … 194 197 // register our listener in OIS. 195 198 keyboard_->setEventCallback(this); 196 // note: OIS will not detect keys that have already been down when the keyboard was created. CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl; 199 // note: OIS will not detect keys that have already been down when the keyboard was created. 200 CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl; 197 201 return true; 198 202 } … … 310 314 void InputManager::setConfigValues() 311 315 { 312 if (joySticksSize_) { std::vector<MultiTypeMath> coeffPos; 316 if (joySticksSize_) 317 { 318 std::vector<MultiTypeMath> coeffPos; 313 319 std::vector<MultiTypeMath> coeffNeg; 314 320 std::vector<MultiTypeMath> zero; … … 323 329 } 324 330 325 ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos"); if (!cont) { cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffPos", coeffPos); getIdentifier()->addConfigValueContainer("CoeffPos", cont); } cont->getValue(&coeffPos); cont = getIdentifier()->getConfigValueContainer("CoeffNeg"); if (!cont) { cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffNeg", coeffNeg); getIdentifier()->addConfigValueContainer("CoeffNeg", cont); } cont->getValue(&coeffNeg); cont = getIdentifier()->getConfigValueContainer("Zero"); if (!cont) { cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "Zero", zero); getIdentifier()->addConfigValueContainer("Zero", cont); } cont->getValue(&zero); // copy values to our own variables for (unsigned int i = 0; i < 24; i++) { joySticksCalibration_[0].positiveCoeff[i] = coeffPos[i]; joySticksCalibration_[0].negativeCoeff[i] = coeffNeg[i]; joySticksCalibration_[0].zeroStates[i] = zero[i]; } } } 331 ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos"); 332 if (!cont) 333 { 334 cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffPos", coeffPos); 335 getIdentifier()->addConfigValueContainer("CoeffPos", cont); 336 } 337 cont->getValue(&coeffPos); 338 339 cont = getIdentifier()->getConfigValueContainer("CoeffNeg"); 340 if (!cont) 341 { 342 cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "CoeffNeg", coeffNeg); 343 getIdentifier()->addConfigValueContainer("CoeffNeg", cont); 344 } 345 cont->getValue(&coeffNeg); 346 347 cont = getIdentifier()->getConfigValueContainer("Zero"); 348 if (!cont) 349 { 350 cont = new ConfigValueContainer(CFT_Keybindings, getIdentifier(), "Zero", zero); 351 getIdentifier()->addConfigValueContainer("Zero", cont); 352 } 353 cont->getValue(&zero); 354 355 // copy values to our own variables 356 for (unsigned int i = 0; i < 24; i++) 357 { 358 joySticksCalibration_[0].positiveCoeff[i] = coeffPos[i]; 359 joySticksCalibration_[0].negativeCoeff[i] = coeffNeg[i]; 360 joySticksCalibration_[0].zeroStates[i] = zero[i]; 361 } 362 } 363 } 326 364 327 365 /** … … 624 662 else 625 663 joySticksCalibration_[0].positiveCoeff[i] = 1.0f; 664 626 665 // config value 627 ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos"); assert(cont); cont->set(i, joySticksCalibration_[0].positiveCoeff[i]); // negative coefficient 666 ConfigValueContainer* cont = getIdentifier()->getConfigValueContainer("CoeffPos"); 667 assert(cont); 668 cont->set(i, joySticksCalibration_[0].positiveCoeff[i]); 669 670 // negative coefficient 628 671 if (marginalsMin_[i] == INT_MAX) 629 672 marginalsMin_[i] = -32768; 630 673 // coefficients 631 674 if (marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i]) 632 joySticksCalibration_[0].negativeCoeff[i] = -1.0f/(marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i]); else joySticksCalibration_[0].negativeCoeff[i] = 1.0f; // config value 633 cont = getIdentifier()->getConfigValueContainer("CoeffNeg"); assert(cont); cont->set(i, joySticksCalibration_[0].negativeCoeff[i]); // zero states 675 joySticksCalibration_[0].negativeCoeff[i] = -1.0f/(marginalsMin_[i] - joySticksCalibration_[0].zeroStates[i]); 676 else 677 joySticksCalibration_[0].negativeCoeff[i] = 1.0f; 678 // config value 679 cont = getIdentifier()->getConfigValueContainer("CoeffNeg"); 680 assert(cont); 681 cont->set(i, joySticksCalibration_[0].negativeCoeff[i]); 682 683 // zero states 634 684 if (i < 8) 635 685 { … … 647 697 } 648 698 // config value 649 cont = getIdentifier()->getConfigValueContainer("Zero"); assert(cont); cont->set(i, joySticksCalibration_[0].zeroStates[i]); } 699 cont = getIdentifier()->getConfigValueContainer("Zero"); 700 assert(cont); 701 cont->set(i, joySticksCalibration_[0].zeroStates[i]); 702 } 650 703 } 651 704
Note: See TracChangeset
for help on using the changeset viewer.