Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4782 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jul 3, 2005, 12:26:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: orxonox-events registered, solved an error in ClassList

Location:
orxonox/trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/event/event.h

    r4457 r4782  
    1 /*! 
     1/*!
    22    \file event.h
    33    \brief an abstract event
     
    2525  int      type;                        //!< the type field
    2626  bool     bPressed;                    //!< is true, if the button/mouse was pressed, false if released
    27        
     27
    2828  Uint16   x;                           //!< x coordinate
    2929  Uint16   y;                           //!< y coordinate
    3030  Sint16   xRel;                        //!< relative x movement to last point
    3131  Sint16   yRel;                        //!< relative y movement to last point
     32
     33  SDL_ResizeEvent resize;
    3234};
    3335
  • orxonox/trunk/src/lib/event/event_def.h

    r4780 r4782  
    3030  EV_JOY_BUTTON,
    3131
     32  EV_VIDEO_RESIZE                 = SDL_VIDEORESIZE,
     33
    3234  EV_UNKNOWN,
    3335
    3436  EV_NUMBER,
    35 
    36   EV_VIDEO_RESIZE                 = SDL_VIDEORESIZE
    3737};
    3838
     
    4747    ES_ALL,            //!< you want to register events for all states
    4848
    49     ES_NUMBER,         //!< the number of states
     49    ES_NUMBER,          //!< the number of states
    5050  };
    5151
  • orxonox/trunk/src/lib/event/event_handler.cc

    r4780 r4782  
    252252          ev.type = EV_JOY_BUTTON;
    253253          break;
     254        case SDL_VIDEORESIZE:
     255          ev.resize = event.resize;
     256          break;
    254257        default:
    255258          ev.type = EV_UNKNOWN;
  • orxonox/trunk/src/lib/graphics/graphics_engine.cc

    r4777 r4782  
    218218   \param resizeInfo SDL information about the size of the new screen size
    219219*/
    220 int GraphicsEngine::resolutionChanged(SDL_ResizeEvent* resizeInfo)
    221 {
    222   this->setResolution(resizeInfo->w, resizeInfo->h, this->bitsPerPixel);
     220int GraphicsEngine::resolutionChanged(const SDL_ResizeEvent& resizeInfo)
     221{
     222  this->setResolution(resizeInfo.w, resizeInfo.h, this->bitsPerPixel);
    223223}
    224224
  • orxonox/trunk/src/lib/graphics/graphics_engine.h

    r4777 r4782  
    4646    inline int getbbp() const { return this->bitsPerPixel; };
    4747
    48     int resolutionChanged(SDL_ResizeEvent* resizeInfo);
     48    int resolutionChanged(const SDL_ResizeEvent& resizeInfo);
    4949
    5050    static void enter2DMode();
  • orxonox/trunk/src/lib/lang/class_list.cc

    r4778 r4782  
    4747ClassList::~ClassList ()
    4848{
     49  delete this->objectList;
    4950  --ClassList::classCount;
    5051}
     
    6566{
    6667  ClassList* regClass;
     68  PRINTF(5)("subscribe a %s\n", className );
    6769
    6870  if(ClassList::first == NULL)
     
    7981      }
    8082
    81       if (tmp->next == NULL)
     83      if (unlikely(tmp->next == NULL))
     84      {
    8285        tmp->next = regClass = new ClassList(classID, className);
     86        break;
     87      }
    8388      tmp = tmp->next;
    8489    }
  • orxonox/trunk/src/lib/lang/class_list.h

    r4764 r4782  
    5252
    5353    // STATIC MEMBERS
    54     static ClassList*        first;                  //!< The first Class in the List (should be BaseObject)
     54    static ClassList*        first;                  //!< The first Class in the List
    5555    static unsigned int      classCount;             //!< The Count of classes that have been registered (should match the lower description)
    5656};
  • orxonox/trunk/src/orxonox.cc

    r4777 r4782  
    6969  this->argc = 0;
    7070  this->argv = NULL;
     71
    7172}
    7273
     
    130131
    131132
     133  // initialize everything
    132134  SDL_Init (SDL_INIT_TIMER);
    133   // initialize everything
    134135  if( initResources () == -1) return -1;
    135136  if( initVideo() == -1) return -1;
     
    137138  if( initInput() == -1) return -1;
    138139  if( initNetworking () == -1) return -1;
    139   //printf("> Initializing world\n");
    140   //if( init_world () == -1) return -1; PB: world will be initialized when started
    141 
     140
     141  // subscribe the resolutionChanged-event
     142  EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);
    142143  return 0;
    143144}
     
    288289    case SDL_VIDEORESIZE:
    289290      GraphicsEngine* tmpGEngine = GraphicsEngine::getInstance();
    290       tmpGEngine->resolutionChanged(&event->resize);
     291      tmpGEngine->resolutionChanged(event->resize);
    291292      break;
    292293    }
     
    299300*/
    300301void Orxonox::process(const Event &event)
    301 {}
     302{
     303  switch (event.type)
     304  {
     305    case EV_VIDEO_RESIZE:
     306      GraphicsEngine::getInstance()->resolutionChanged(event.resize);
     307      break;
     308  }
     309
     310}
    302311
    303312
Note: See TracChangeset for help on using the changeset viewer.