Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7906 in orxonox.OLD


Ignore:
Timestamp:
May 27, 2006, 2:53:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: very smooth cursor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl_gui/glgui_cursor.cc

    r7905 r7906  
    7676    if (this->movement != Vector2D())
    7777    {
    78       if (this->getAbsCoor2D().x < 0.0 )
    79         movement.x = -this->getAbsCoor2D().x;
    80       if (this->getAbsCoor2D().x > this->_maxBorders.x)
    81         movement.x = (this->_maxBorders.x-this->getAbsCoor2D().x);
    82       if (this->getAbsCoor2D().y < 0.0 )
    83         movement.y = -this->getAbsCoor2D().y;
    84       if (this->getAbsCoor2D().y > this->_maxBorders.y)
    85         movement.y = (this->_maxBorders.y-this->getAbsCoor2D().y);
     78      newPos += movement;
     79      // reposition the cursor.
     80      if (newPos.x < 0.0f )
     81        newPos.x = 0.0f;
     82      if (newPos.x > this->_maxBorders.x)
     83        newPos.x = this->_maxBorders.x;
     84      if (newPos.y < 0.0f )
     85        newPos.y = 0.0f;
     86      if (newPos.y > this->_maxBorders.y)
     87        newPos.y = this->_maxBorders.y;
    8688
    87       newPos += movement;
    8889
    89       this->setAbsCoor2D(newPos);
     90      this->setAbsCoorSoft2D(newPos, 10);
    9091      movement = Vector2D();
    9192    }
     
    115116        break;
    116117      case EV_MOUSE_MOTION:
    117         // newPos = Vector2D(event.x, event.y);
    118118        movement += Vector2D((float)event.xRel * _mouseSensitivity, (float)event.yRel * _mouseSensitivity);
    119         movement.debug();
    120119        break;
    121120
Note: See TracChangeset for help on using the changeset viewer.