EventReceiver Question

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
chaoslion
Posts: 25
Joined: Sun Oct 30, 2005 1:44 pm

EventReceiver Question

Post by chaoslion »

Hey guys,

i got a little problem with my eventrec class:

Code: Select all

bool GuiManager::OnEvent(irr::SEvent e) {

	switch( e.EventType ) {
		case irr::EET_GUI_EVENT:
			return this->parseGuiEvent(e);			
		case irr::EET_KEY_INPUT_EVENT:
			return this->parseKeyEvent(e);
		case irr::EET_MOUSE_INPUT_EVENT:
			return this->parseMouseEvent(e);		
	}	

	return false;
}
but it never handels the gui events, but does handle the key and mouse events.
if i change the function this way:

Code: Select all

bool GuiManager::OnEvent(irr::SEvent e) {

	switch( e.EventType ) {
		case irr::EET_GUI_EVENT:
			return this->parseGuiEvent(e);			
		case irr::EET_KEY_INPUT_EVENT:
			return false;
		case irr::EET_MOUSE_INPUT_EVENT:
			return false;
	}	

	return false;
}
he handles the gui events..

where do you think is the problem in this??

regards
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I don't know what your this->parseGuiEvent(e); (and the other parse functions) return...
but you must always return true if you handled events successfully !!! ;)

so your second code snipet should look like this:

Code: Select all

bool GuiManager::OnEvent(irr::SEvent e) {

   switch( e.EventType ) {
      case irr::EET_GUI_EVENT:
         return this->parseGuiEvent(e); // must return true if success !!!
      case irr::EET_KEY_INPUT_EVENT:
         return true;
      case irr::EET_MOUSE_INPUT_EVENT:
         return true;
   }   

   return false;
} 
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply