Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4817 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Jul 7, 2005, 5:12:45 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: orxonox is now baseobject, graphicsengine handles events itself and is therefore eventlistener now

Location:
orxonox/trunk/src/lib
Files:
4 edited

Legend:

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

    r4816 r4817  
    6565  EventHandler::singletonRef = NULL;
    6666  delete this->keyMapper;
     67
     68  for(int i = 0; i < ES_NUMBER; ++i)
     69  {
     70    for(int j = 0; j < SDLK_LAST; ++j)
     71    {
     72      if( this->listeners[i][j] != NULL)
     73      {
     74        PRINTF(2)("Someone forgot to unsubscribe an EventListener!\n");
     75      }
     76    }
     77  }
    6778}
    6879
  • orxonox/trunk/src/lib/event/event_listener.cc

    r4457 r4817  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    1717
    1818#include "event_listener.h"
     19#include "event_handler.h"
    1920
    2021using namespace std;
     
    2425   \brief standard constructor
    2526*/
    26 EventListener::EventListener () 
     27EventListener::EventListener ()
    2728{
    28    this->setClassID(CL_EVENT_LISTENER, "EventListener"); 
     29   this->setClassID(CL_EVENT_LISTENER, "EventListener");
    2930}
    3031
     
    3435
    3536*/
    36 EventListener::~EventListener ()
    37 {}
     37EventListener::~EventListener ()
     38{
     39  /* unsubscribes itself from the event listener */
     40  EventHandler::getInstance()->unsubscribe(this);
     41}
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4784 r4817  
    1818#include "graphics_engine.h"
    1919#include "resource_manager.h"
     20#include "event_handler.h"
    2021
    2122#include "debug.h"
     
    4647
    4748//  this->listModes();
     49
     50  // subscribe the resolutionChanged-event
     51  EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);
     52
    4853}
    4954
     
    5964{
    6065  // delete what has to be deleted here
     66  EventHandler::getInstance()->unsubscribe(this);
    6167}
    6268
     
    389395
    390396
     397/**
     398  \brief processes the events for orxonox main class
     399  \param the event to handle
     400 */
     401void GraphicsEngine::process(const Event &event)
     402{
     403  switch (event.type)
     404  {
     405    case EV_VIDEO_RESIZE:
     406      this->resolutionChanged(event.resize);
     407      break;
     408  }
     409
     410}
     411
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4784 r4817  
    55
    66    handles graphical SDL-initialisation, textures, resolutions, and so on
    7 */
     7 */
    88
    99#ifndef _GRAPHICS_ENGINE_H
    1010#define _GRAPHICS_ENGINE_H
    1111
    12 #include "base_object.h"
     12#include "event_listener.h"
    1313
    1414#include "sdlincl.h"
     
    2323   handles graphical SDL-initialisation, textures, resolutions, and so on
    2424 */
    25 class GraphicsEngine : public BaseObject
     25class GraphicsEngine : public EventListener
    2626{
    2727  public:
     
    6464    static void swapBuffers() { SDL_GL_SwapBuffers(); };
    6565
     66    void process(const Event  &event);
    6667
    6768  private:
Note: See TracChangeset for help on using the changeset viewer.