Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5553 in orxonox.OLD for trunk/src/util/loading


Ignore:
Timestamp:
Nov 12, 2005, 1:58:30 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Quit Events are listened on.

  1. Quit-Button from the Windows Handler works
  2. ctrl-c also quits the game.

(smoothly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/loading/game_loader.cc

    r5300 r5553  
    8989  this->eventHandler = EventHandler::getInstance();
    9090  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_PAUSE);
     91  this->eventHandler->subscribe(this, ES_ALL, EV_MAIN_QUIT);          //< External Quit Event
    9192  this->eventHandler->subscribe(this, ES_ALL, KeyMapper::PEV_QUIT);
    9293  this->eventHandler->subscribe(this, ES_GAME, KeyMapper::PEV_NEXT_WORLD);
     
    274275 *  handle keyboard commands
    275276 * @param event the event to handle
    276 */
     277 */
    277278void GameLoader::process(const Event& event)
    278279{
    279280  if( event.type == KeyMapper::PEV_NEXT_WORLD)
    280     {
    281       if( likely(event.bPressed))
    282         {
    283           this->nextLevel();
    284         }
    285     }
     281  {
     282    if( likely(event.bPressed))
     283    {
     284      this->nextLevel();
     285    }
     286  }
    286287  else if( event.type == KeyMapper::PEV_PREVIOUS_WORLD)
    287     {
    288       if( likely(event.bPressed))
    289         {
    290           this->previousLevel();
    291         }
    292     }
     288  {
     289    if( likely(event.bPressed))
     290    {
     291      this->previousLevel();
     292    }
     293  }
    293294  else if( event.type == KeyMapper::PEV_PAUSE)
    294     {
    295       if( likely(event.bPressed))
    296         {
    297           if(this->isPaused)
    298             this->resume();
    299           else
    300             this->pause();
    301         }
    302     }
     295  {
     296    if( likely(event.bPressed))
     297    {
     298      if(this->isPaused)
     299        this->resume();
     300      else
     301        this->pause();
     302    }
     303  }
    303304  else if( event.type == KeyMapper::PEV_QUIT)
    304     {
    305       if( event.bPressed) this->stop();
    306     }
     305  {
     306    if( event.bPressed) this->stop();
     307  }
     308  else if (event.type == EV_MAIN_QUIT)
     309    this->stop();
    307310}
    308311
Note: See TracChangeset for help on using the changeset viewer.