Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8743 in orxonox.OLD


Ignore:
Timestamp:
Jun 23, 2006, 3:17:15 PM (18 years ago)
Author:
bensch
Message:

gui: event-handler now supports retrieving key-states

Location:
trunk/src/lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/event/event_handler.cc

    r8717 r8743  
    4949  this->state = ES_GAME;
    5050  this->eventsGrabbed = false;
     51
     52  this->keyState = SDL_GetKeyState(NULL);
    5153}
    5254
  • trunk/src/lib/event/event_handler.h

    r8623 r8743  
    4242  bool isSubscribed(elState state, int eventType);
    4343
     44  /** @param key the key to check @returns true if key is pressed */
     45  bool isPressed(SDLKey key) const { return this->keyState[key]; };
    4446
    4547  void withUNICODE(elState state, bool enableUNICODE);
     
    7678  bool                         bUNICODE[ES_NUMBER];             //!< If unicode should be enabled.
    7779  bool                         eventsGrabbed;                   //!< If the events should be grabbed
     80
     81  Uint8*                       keyState;
    7882};
    7983
  • trunk/src/lib/gui/gl/glgui_handler.cc

    r8742 r8743  
    238238      case SDLK_TAB:
    239239        if (event.bPressed)
    240           this->selectNext();
     240        {
     241          if (EventHandler::getInstance()->isPressed(SDLK_LSHIFT) || EventHandler::getInstance()->isPressed(SDLK_RSHIFT))
     242            this->selectPrevious();
     243          else
     244            this->selectNext();
     245        }
    241246        break;
    242247    }
     
    277282  void GLGuiHandler::checkFocus()
    278283  {
    279    // CHECK THE COLLISIONS.
     284    // CHECK THE COLLISIONS.
    280285    const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET);
    281286
Note: See TracChangeset for help on using the changeset viewer.