Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

borders

File:
1 edited

Legend:

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

    r7891 r7905  
    3333
    3434    this->subscribeEvent(ES_MENU,  EV_MOUSE_MOTION);
     35    this->subscribeEvent(ES_MENU, EV_WINDOW_FOCUS);
    3536
    3637
     
    7374    this->backMaterial().setDiffuse(color.x, color.y, color.z);
    7475
    75     //if (this->movement != Vector2D())
     76    if (this->movement != Vector2D())
    7677    {
    77 /*      if (this->getAbsCoor2D().x < 0.0 )
     78      if (this->getAbsCoor2D().x < 0.0 )
    7879        movement.x = -this->getAbsCoor2D().x;
    79       if (this->getAbsCoor2D().x > 200.0)
    80         movement.x = (200.0-this->getAbsCoor2D().x);
     80      if (this->getAbsCoor2D().x > this->_maxBorders.x)
     81        movement.x = (this->_maxBorders.x-this->getAbsCoor2D().x);
    8182      if (this->getAbsCoor2D().y < 0.0 )
    82         movement.x = -this->getAbsCoor2D().y;
    83       if (this->getAbsCoor2D().y > 200.0)
    84         movement.x = (200.0-this->getAbsCoor2D().y);*/
     83        movement.y = -this->getAbsCoor2D().y;
     84      if (this->getAbsCoor2D().y > this->_maxBorders.y)
     85        movement.y = (this->_maxBorders.y-this->getAbsCoor2D().y);
    8586
     87      newPos += movement;
    8688
    87 
    88       //this->shiftCoor2D(movement);
    8989      this->setAbsCoor2D(newPos);
    9090      movement = Vector2D();
     
    106106    switch (event.type)
    107107    {
     108      case EV_WINDOW_FOCUS:
     109        if (event.bPressed)
     110        {
     111          int mouseX, mouseY;
     112          SDL_GetMouseState(&mouseX, &mouseY);
     113          newPos = Vector2D(mouseX, mouseY);
     114        }
     115        break;
    108116      case EV_MOUSE_MOTION:
    109         newPos = Vector2D(event.x, event.y);
    110         movement += Vector2D(event.xRel * _mouseSensitivity, event.yRel * _mouseSensitivity);
     117        // newPos = Vector2D(event.x, event.y);
     118        movement += Vector2D((float)event.xRel * _mouseSensitivity, (float)event.yRel * _mouseSensitivity);
     119        movement.debug();
    111120        break;
    112121
Note: See TracChangeset for help on using the changeset viewer.