Changeset 4817 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Jul 7, 2005, 5:12:45 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/event/event_handler.cc
r4816 r4817 65 65 EventHandler::singletonRef = NULL; 66 66 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 } 67 78 } 68 79 -
orxonox/trunk/src/lib/event/event_listener.cc
r4457 r4817 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 17 17 18 18 #include "event_listener.h" 19 #include "event_handler.h" 19 20 20 21 using namespace std; … … 24 25 \brief standard constructor 25 26 */ 26 EventListener::EventListener () 27 EventListener::EventListener () 27 28 { 28 this->setClassID(CL_EVENT_LISTENER, "EventListener"); 29 this->setClassID(CL_EVENT_LISTENER, "EventListener"); 29 30 } 30 31 … … 34 35 35 36 */ 36 EventListener::~EventListener () 37 {} 37 EventListener::~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 18 18 #include "graphics_engine.h" 19 19 #include "resource_manager.h" 20 #include "event_handler.h" 20 21 21 22 #include "debug.h" … … 46 47 47 48 // this->listModes(); 49 50 // subscribe the resolutionChanged-event 51 EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE); 52 48 53 } 49 54 … … 59 64 { 60 65 // delete what has to be deleted here 66 EventHandler::getInstance()->unsubscribe(this); 61 67 } 62 68 … … 389 395 390 396 397 /** 398 \brief processes the events for orxonox main class 399 \param the event to handle 400 */ 401 void 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 5 5 6 6 handles graphical SDL-initialisation, textures, resolutions, and so on 7 */7 */ 8 8 9 9 #ifndef _GRAPHICS_ENGINE_H 10 10 #define _GRAPHICS_ENGINE_H 11 11 12 #include " base_object.h"12 #include "event_listener.h" 13 13 14 14 #include "sdlincl.h" … … 23 23 handles graphical SDL-initialisation, textures, resolutions, and so on 24 24 */ 25 class GraphicsEngine : public BaseObject25 class GraphicsEngine : public EventListener 26 26 { 27 27 public: … … 64 64 static void swapBuffers() { SDL_GL_SwapBuffers(); }; 65 65 66 void process(const Event &event); 66 67 67 68 private: -
orxonox/trunk/src/orxonox.cc
r4815 r4817 90 90 delete ObjectManager::getInstance(); 91 91 delete TextEngine::getInstance(); 92 delete EventHandler::getInstance();93 92 delete Factory::getFirst(); 94 93 delete GameLoader::getInstance(); … … 97 96 delete CDEngine::getInstance(); 98 97 delete GarbageCollector::getInstance(); 98 99 delete EventHandler::getInstance(); 99 100 100 101 ClassList::debug(0); … … 148 149 if( initNetworking () == -1) return -1; 149 150 150 // subscribe the resolutionChanged-event151 EventHandler::getInstance()->subscribe(this, ES_GAME, EV_VIDEO_RESIZE);152 151 return 0; 153 152 } … … 291 290 \param event: an event not handled by the CommandNode 292 291 */ 293 void Orxonox::graphicsHandler(SDL_Event* event) 294 { 295 // Handle special events such as reshape, quit, focus changes 296 switch (event->type) 297 { 298 case SDL_VIDEORESIZE: 299 GraphicsEngine* tmpGEngine = GraphicsEngine::getInstance(); 300 tmpGEngine->resolutionChanged(event->resize); 301 break; 302 } 303 } 304 305 306 /** 307 \brief processes the events for orxonox main class 308 \param the event to handle 309 */ 310 void Orxonox::process(const Event &event) 311 { 312 switch (event.type) 313 { 314 case EV_VIDEO_RESIZE: 315 GraphicsEngine::getInstance()->resolutionChanged(event.resize); 316 break; 317 } 318 319 } 292 // void Orxonox::graphicsHandler(SDL_Event* event) 293 // { 294 // // Handle special events such as reshape, quit, focus changes 295 // switch (event->type) 296 // { 297 // case SDL_VIDEORESIZE: 298 // GraphicsEngine* tmpGEngine = GraphicsEngine::getInstance(); 299 // tmpGEngine->resolutionChanged(event->resize); 300 // break; 301 // } 302 // } 303 304 305 320 306 321 307 -
orxonox/trunk/src/orxonox.h
r4768 r4817 7 7 #define _ORXONOX_H 8 8 9 #include " event_listener.h"9 #include "base_object.h" 10 10 11 11 class WorldEntity; … … 20 20 /** 21 21 */ 22 class Orxonox : public EventListener{22 class Orxonox : public BaseObject { 23 23 24 24 public: … … 31 31 void start(); 32 32 33 void graphicsHandler (SDL_Event* event); 34 void process(const Event &event); 33 //void graphicsHandler (SDL_Event* event); 35 34 36 35 private: -
orxonox/trunk/src/util/loading/game_loader.cc
r4816 r4817 54 54 delete this->currentCampaign; 55 55 this->currentCampaign = NULL; 56 this->eventHandler->unsubscribe(this, ES_ALL); 56 57 } 57 58
Note: See TracChangeset
for help on using the changeset viewer.