Changeset 7903 in orxonox.OLD for branches/gui/src/lib/event
- Timestamp:
- May 27, 2006, 2:18:55 PM (18 years ago)
- Location:
- branches/gui/src/lib/event
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/event/event_def.h
r7868 r7903 30 30 EV_VIDEO_RESIZE, 31 31 32 EV_LEAVE_STATE, 32 33 EV_MAIN_QUIT, 33 34 -
branches/gui/src/lib/event/event_handler.cc
r7898 r7903 93 93 void EventHandler::setState(elState state) 94 94 { 95 if (state == this->state) 96 return; 97 95 98 /// When Changing the State, all the keys will be released. 96 99 /// This is done by sending each eventListener, that still … … 107 110 if (unlikely(this->bUNICODE[this->state])) 108 111 ev.x = i; 109 this->dispachEvent( ev ); 110 } 111 } 112 112 this->dispachEvent(this->state, ev ); 113 } 114 } 115 116 // switching to the new State. 117 elState oldState = this->state; 113 118 this->state = state; 119 120 // in the End the Corresponding handler will be notified. 121 Event stateSwitchEvent; 122 stateSwitchEvent.type = EV_LEAVE_STATE; 123 this->dispachEvent(oldState, stateSwitchEvent); 124 114 125 SDL_EnableUNICODE(this->bUNICODE[state]); 115 126 }; … … 388 399 break; 389 400 } 390 this->dispachEvent( ev);401 this->dispachEvent(this->state, ev); 391 402 } 392 403 } … … 397 408 * @param event the Event to dispach. 398 409 */ 399 void EventHandler::dispachEvent( const Event& event) const410 void EventHandler::dispachEvent(elState state, const Event& event) const 400 411 { 401 412 /* small debug routine: shows all events dispatched by the event handler */ 402 413 PRINT(4)("\n==========================| EventHandler::process () |===\n"); 403 PRINT(4)("= Got Event nr %i, for state %i\n", event.type, this->state);414 PRINT(4)("= Got Event nr %i, for state %i\n", event.type, state); 404 415 405 416 /// setting a temporary state in case of an EventListener's process changes the state. 406 elState currentState = this->state; 407 for (unsigned int i = 0; i < this->listeners[currentState][event.type].size(); i++) 417 for (unsigned int i = 0; i < this->listeners[state][event.type].size(); i++) 408 418 { 409 419 PRINT(4)("= Event dispatcher msg: This event has been consumed\n"); 410 PRINT(4)("= Got Event nr %i, for state %i %s::%s\n", event.type, currentState, this->listeners[this->state][event.type][i]->getClassName(), this->listeners[currentState][event.type][i]->getName());420 PRINT(4)("= Got Event nr %i, for state %i %s::%s\n", event.type, state, this->listeners[state][event.type][i]->getClassName(), this->listeners[state][event.type][i]->getName()); 411 421 PRINT(4)("=======================================================\n"); 412 this->listeners[ currentState][event.type][i]->process(event);422 this->listeners[state][event.type][i]->process(event); 413 423 } 414 424 /* else -
branches/gui/src/lib/event/event_handler.h
r7897 r7903 47 47 48 48 void process() const; 49 void dispachEvent( const Event& event) const;49 void dispachEvent(elState state, const Event& event) const; 50 50 51 51 static int eventFilter(const SDL_Event *event);
Note: See TracChangeset
for help on using the changeset viewer.