Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7905 in orxonox.OLD


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

borders

Location:
branches/gui/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/event/event_def.h

    r7903 r7905  
    2828  EV_JOY_BUTTON,
    2929
     30  EV_WINDOW_FOCUS,
    3031  EV_VIDEO_RESIZE,
    3132
  • branches/gui/src/lib/event/event_handler.cc

    r7903 r7905  
    388388        ev.type = EV_JOY_BUTTON;
    389389        break;
     390      case SDL_ACTIVEEVENT:
     391        ev.type = EV_WINDOW_FOCUS;
     392        ev.bPressed = (event.active.gain != 0);
     393        break;
    390394      case SDL_VIDEORESIZE:
    391395        ev.resize = event.resize;
  • 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
  • branches/gui/src/lib/gui/gl_gui/glgui_cursor.h

    r7891 r7905  
    3030    static float mouseSensitivity() { return GLGuiCursor::_mouseSensitivity; };
    3131
     32    void setMaxBorders(const Vector2D& maxBorders) { this->_maxBorders = maxBorders; };
     33
    3234    void init();
    3335    const Vector2D& position() const { return Element2D::getAbsCoor2D(); }
     
    3840    virtual void process(const Event& event);
    3941  private:
     42
     43    Vector2D      _maxBorders;
    4044
    4145    Vector2D      newPos;
  • branches/gui/src/lib/gui/gl_gui/glgui_handler.cc

    r7903 r7905  
    2424#include "class_list.h"
    2525
     26
     27/// TAKE THIS OUT OF HERE.
     28#include "graphics_engine.h"
    2629
    2730namespace OrxGui
     
    6467      this->cursor = new GLGuiCursor();
    6568    this->cursor->show();
     69    this->cursor->setMaxBorders(Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY()));
    6670  }
    6771
Note: See TracChangeset for help on using the changeset viewer.