Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2008, 4:02:03 PM (16 years ago)
Author:
rgrieder
Message:
  • fixed some bugs
Location:
code/branches/network/src/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/core/CommandExecutor.cc

    r1349 r1391  
    403403        if (evaluation.bEvaluatedParams_ && evaluation.evaluatedExecutor_)
    404404        {
    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;
    406406            (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]);
    407407            return true;
    408408        }
    409409
    410 std::cout << "CE_execute: " << evaluation.processedCommand_ << "\n";
     410//std::cout << "CE_execute: " << evaluation.processedCommand_ << "\n";
    411411        switch (evaluation.state_)
    412412        {
  • code/branches/network/src/core/InputHandler.cc

    r1349 r1391  
    159159        // default amplitude is 1.0f
    160160        float paramModifier = 1.0f;
    161         if (getLowercase(tokens[iToken]) == "axisamp")
     161        if (getLowercase(tokens[iToken]) == "scale")
    162162        {
    163163          iToken++;
     
    307307  KeyBinder::KeyBinder() : deriveTime_(0.0f)
    308308  {
     309    mouseRelative_[0] = 0;
     310    mouseRelative_[1] = 0;
     311    mousePosition_[0] = 0;
     312    mousePosition_[1] = 0;
     313
    309314    RegisterObject(KeyBinder);
    310315
     
    477482  {
    478483    SetConfigValue(analogThreshold_, 0.01f)  .description("Threshold for analog axes until which the state is 0.");
     484    SetConfigValue(mouseSensitivity_, 1.0f)  .description("Mouse sensitivity.");
    479485    SetConfigValue(bDeriveMouseInput_, false).description("Whether or not to derive moues movement for the absolute value.");
    480     SetConfigValue(derivePeriod_, 0.1f)      .description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
    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.");
    482488
    483489    float oldThresh = buttonThreshold_;
     
    574580      if (halfAxes_[i].relVal_ > analogThreshold_ || halfAxes_[i].absVal_ > analogThreshold_)
    575581      {
     582        COUT(3) << halfAxes_[i].name_ << "\t" << halfAxes_[i].absVal_ << std::endl;
    576583        halfAxes_[i].execute();
    577584      }
     
    588595          if (mouseRelative_[i] > 0)
    589596          {
    590             halfAxes_[2*i + 0].absVal_ = mouseRelative_[i] * derivePeriod_ / 500 * mouseSensitivity_;
     597            halfAxes_[2*i + 0].absVal_ =  mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_;
    591598            halfAxes_[2*i + 1].absVal_ = 0.0f;
    592599          }
    593           else if (mouseRelative_[0] < 0)
     600          else if (mouseRelative_[i] < 0)
    594601          {
    595602            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;
    597609          }
    598610          //COUT(3) << mouseRelative_[i] << " | ";
     
    672684            }
    673685            else
    674               halfAxes_[1 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
     686              halfAxes_[0 + 2*i].absVal_ =  ((float)mousePosition_[i])/1024 * mouseSensitivity_;
    675687          }
    676688          else
     
    687699              halfAxes_[1 + 2*i].absVal_ = -((float)mousePosition_[i])/1024 * mouseSensitivity_;
    688700          }
     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;
    689705
    690706          // relative
     
    722738  {
    723739    // 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;
    725741    if (value >= 0)
    726742    {
    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      }
    730755    }
    731756    else
    732757    {
    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      }
    736770    }
    737771  }
  • code/branches/network/src/core/InputHandler.h

    r1349 r1391  
    208208
    209209    //! Keeps track of the absolute mouse value (incl. scroll wheel)
    210     int mousePosition_[3];
     210    int mousePosition_[2];
    211211    //! Used to derive mouse input if requested
    212212    int mouseRelative_[2];
     
    224224    //! mouse sensitivity
    225225    float mouseSensitivity_;
     226    //! mouse sensitivity if mouse input is derived
     227    float mouseSensitivityDerived_;
    226228  };
    227229
  • code/branches/network/src/core/InputManager.cc

    r1349 r1391  
    603603
    604604    // 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];
    606606    unsigned int iButton = 0;
    607607    while (iButton < buttonsDown.size() && buttonsDown[iButton] != button)
     
    625625
    626626    // remove the button from the joyStickButtonsDown_ list
    627     std::vector<int> buttonsDown = joyStickButtonsDown_[iJoyStick];
     627    std::vector<int>& buttonsDown = joyStickButtonsDown_[iJoyStick];
    628628    for (unsigned int iButton = 0; iButton < buttonsDown.size(); iButton++)
    629629    {
     
    643643  bool InputManager::axisMoved(const OIS::JoyStickEvent &arg, int axis)
    644644  {
    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;}
    646647    // use the device to identify which one called the method
    647648    OIS::JoyStick* joyStick = (OIS::JoyStick*)arg.device;
     
    659660  bool InputManager::sliderMoved(const OIS::JoyStickEvent &arg, int id)
    660661  {
     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;}
    661664    //CCOUT(3) << arg.state.mSliders[id].abX << "\t |" << arg.state.mSliders[id].abY << std::endl;
    662665    // use the device to identify which one called the method
Note: See TracChangeset for help on using the changeset viewer.