Changeset 1391 for code/branches/network/src/core
- Timestamp:
- May 23, 2008, 4:02:03 PM (17 years ago)
- Location:
- code/branches/network/src/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network/src/core/CommandExecutor.cc
r1349 r1391 403 403 if (evaluation.bEvaluatedParams_ && evaluation.evaluatedExecutor_) 404 404 { 405 std::cout << "CE_execute (evaluation): " << evaluation.evaluatedExecutor_->getName() << " " << evaluation.param_[0] << " " << evaluation.param_[1] << " " << evaluation.param_[2] << " " << evaluation.param_[3] << " " << evaluation.param_[4] << std::endl;405 //std::cout << "CE_execute (evaluation): " << evaluation.evaluatedExecutor_->getName() << " " << evaluation.param_[0] << " " << evaluation.param_[1] << " " << evaluation.param_[2] << " " << evaluation.param_[3] << " " << evaluation.param_[4] << std::endl; 406 406 (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]); 407 407 return true; 408 408 } 409 409 410 std::cout << "CE_execute: " << evaluation.processedCommand_ << "\n";410 //std::cout << "CE_execute: " << evaluation.processedCommand_ << "\n"; 411 411 switch (evaluation.state_) 412 412 { -
code/branches/network/src/core/InputHandler.cc
r1349 r1391 159 159 // default amplitude is 1.0f 160 160 float paramModifier = 1.0f; 161 if (getLowercase(tokens[iToken]) == " axisamp")161 if (getLowercase(tokens[iToken]) == "scale") 162 162 { 163 163 iToken++; … … 307 307 KeyBinder::KeyBinder() : deriveTime_(0.0f) 308 308 { 309 mouseRelative_[0] = 0; 310 mouseRelative_[1] = 0; 311 mousePosition_[0] = 0; 312 mousePosition_[1] = 0; 313 309 314 RegisterObject(KeyBinder); 310 315 … … 477 482 { 478 483 SetConfigValue(analogThreshold_, 0.01f) .description("Threshold for analog axes until which the state is 0."); 484 SetConfigValue(mouseSensitivity_, 1.0f) .description("Mouse sensitivity."); 479 485 SetConfigValue(bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value."); 480 SetConfigValue(derivePeriod_, 0.1f) 481 SetConfigValue(mouseSensitivity _, 1.0f) .description("Mouse sensitivity.");486 SetConfigValue(derivePeriod_, 0.1f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier."); 487 SetConfigValue(mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived."); 482 488 483 489 float oldThresh = buttonThreshold_; … … 574 580 if (halfAxes_[i].relVal_ > analogThreshold_ || halfAxes_[i].absVal_ > analogThreshold_) 575 581 { 582 COUT(3) << halfAxes_[i].name_ << "\t" << halfAxes_[i].absVal_ << std::endl; 576 583 halfAxes_[i].execute(); 577 584 } … … 588 595 if (mouseRelative_[i] > 0) 589 596 { 590 halfAxes_[2*i + 0].absVal_ = mouseRelative_[i] * derivePeriod_ / 500 * mouseSensitivity_;597 halfAxes_[2*i + 0].absVal_ = mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_; 591 598 halfAxes_[2*i + 1].absVal_ = 0.0f; 592 599 } 593 else if (mouseRelative_[ 0] < 0)600 else if (mouseRelative_[i] < 0) 594 601 { 595 602 halfAxes_[2*i + 0].absVal_ = 0.0f; 596 halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] * derivePeriod_ / 500 * mouseSensitivity_; 603 halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_; 604 } 605 else 606 { 607 halfAxes_[2*i + 0].absVal_ = 0.0f; 608 halfAxes_[2*i + 1].absVal_ = 0.0f; 597 609 } 598 610 //COUT(3) << mouseRelative_[i] << " | "; … … 672 684 } 673 685 else 674 halfAxes_[ 1+ 2*i].absVal_ = ((float)mousePosition_[i])/1024 * mouseSensitivity_;686 halfAxes_[0 + 2*i].absVal_ = ((float)mousePosition_[i])/1024 * mouseSensitivity_; 675 687 } 676 688 else … … 687 699 halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_; 688 700 } 701 //COUT(3) << "half axis 0: " << halfAxes_[0].absVal_ << std::endl; 702 //COUT(3) << "half axis 1: " << halfAxes_[1].absVal_ << std::endl; 703 //COUT(3) << "half axis 2: " << halfAxes_[2].absVal_ << std::endl; 704 //COUT(3) << "half axis 3: " << halfAxes_[3].absVal_ << std::endl; 689 705 690 706 // relative … … 722 738 { 723 739 // TODO: check whether 16 bit integer as general axis value is a good idea (works under windows) 724 CCOUT(3) << halfAxes_[8 + axis].name_ << std::endl;740 int i = 8 + axis * 2; 725 741 if (value >= 0) 726 742 { 727 halfAxes_[8 + axis].absVal_ = ((float)value)/0x8000; 728 halfAxes_[8 + axis].relVal_ = ((float)value)/0x8000; 729 halfAxes_[8 + axis].hasChanged_ = true; 743 //if (value > 10000) 744 //{ CCOUT(3) << halfAxes_[i].name_ << std::endl; } 745 746 halfAxes_[i].absVal_ = ((float)value)/0x8000; 747 halfAxes_[i].relVal_ = ((float)value)/0x8000; 748 halfAxes_[i].hasChanged_ = true; 749 if (halfAxes_[i + 1].absVal_ > 0) 750 { 751 halfAxes_[i + 1].absVal_ = -0.0f; 752 halfAxes_[i + 1].relVal_ = -0.0f; 753 halfAxes_[i + 1].hasChanged_ = true; 754 } 730 755 } 731 756 else 732 757 { 733 halfAxes_[8 + axis + 1].absVal_ = -((float)value)/0x8000; 734 halfAxes_[8 + axis + 1].relVal_ = -((float)value)/0x8000; 735 halfAxes_[8 + axis + 1].hasChanged_ = true; 758 //if (value < -10000) 759 //{ CCOUT(3) << halfAxes_[i + 1].name_ << std::endl; } 760 761 halfAxes_[i + 1].absVal_ = -((float)value)/0x8000; 762 halfAxes_[i + 1].relVal_ = -((float)value)/0x8000; 763 halfAxes_[i + 1].hasChanged_ = true; 764 if (halfAxes_[i].absVal_ > 0) 765 { 766 halfAxes_[i].absVal_ = -0.0f; 767 halfAxes_[i].relVal_ = -0.0f; 768 halfAxes_[i].hasChanged_ = true; 769 } 736 770 } 737 771 } -
code/branches/network/src/core/InputHandler.h
r1349 r1391 208 208 209 209 //! Keeps track of the absolute mouse value (incl. scroll wheel) 210 int mousePosition_[ 3];210 int mousePosition_[2]; 211 211 //! Used to derive mouse input if requested 212 212 int mouseRelative_[2]; … … 224 224 //! mouse sensitivity 225 225 float mouseSensitivity_; 226 //! mouse sensitivity if mouse input is derived 227 float mouseSensitivityDerived_; 226 228 }; 227 229 -
code/branches/network/src/core/InputManager.cc
r1349 r1391 603 603 604 604 // check whether the button already is in the list (can happen when focus was lost) 605 std::vector<int> buttonsDown = joyStickButtonsDown_[iJoyStick];605 std::vector<int>& buttonsDown = joyStickButtonsDown_[iJoyStick]; 606 606 unsigned int iButton = 0; 607 607 while (iButton < buttonsDown.size() && buttonsDown[iButton] != button) … … 625 625 626 626 // remove the button from the joyStickButtonsDown_ list 627 std::vector<int> buttonsDown = joyStickButtonsDown_[iJoyStick];627 std::vector<int>& buttonsDown = joyStickButtonsDown_[iJoyStick]; 628 628 for (unsigned int iButton = 0; iButton < buttonsDown.size(); iButton++) 629 629 { … … 643 643 bool InputManager::axisMoved(const OIS::JoyStickEvent &arg, int axis) 644 644 { 645 //CCOUT(3) << arg.state.mAxes[axis].abs << std::endl; 645 //if (arg.state.mAxes[axis].abs > 10000 || arg.state.mAxes[axis].abs < -10000) 646 //{ CCOUT(3) << "axis " << axis << " moved" << arg.state.mAxes[axis].abs << std::endl;} 646 647 // use the device to identify which one called the method 647 648 OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device; … … 659 660 bool InputManager::sliderMoved(const OIS::JoyStickEvent &arg, int id) 660 661 { 662 //if (arg.state.mSliders[id].abX > 10000 || arg.state.mSliders[id].abX < -10000) 663 //{CCOUT(3) << "slider " << id << " moved" << arg.state.mSliders[id].abX << std::endl;} 661 664 //CCOUT(3) << arg.state.mSliders[id].abX << "\t |" << arg.state.mSliders[id].abY << std::endl; 662 665 // use the device to identify which one called the method
Note: See TracChangeset
for help on using the changeset viewer.