a simple mouse click calls a function [solved]

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
~ Dream
Posts: 12
Joined: Fri Jun 29, 2007 11:28 am
Location: The Dream World

a simple mouse click calls a function [solved]

Post by ~ Dream »

I did something like this but it doesn't work

Code: Select all

bool OnEvent(SEvent event)
	{
		if (event.EventType == irr::EET_MOUSE_INPUT_EVENT)
		{
			switch (event.MouseInput.Event) //probably this line or the next one
			{
			case irr::KEY_LBUTTON: //probably this line or the previous one
				happen = CheckCoordinates::checkCoord(stage, x,y,z);
				return true;
			}
		}

		return false;
	}
};
but if I use this, it works.

Code: Select all

bool OnEvent(SEvent event)
	{
		if (event.EventType == irr::EET_KEY_INPUT_EVENT)
		{
			switch (event.KeyInput.Key)
			{
			case irr::KEY_KEY_X:
				happen = CheckCoordinates::checkCoord(stage, x,y,z);
				return true;
			}
		}

		return false;
	}
};
Last edited by ~ Dream on Fri Jul 27, 2007 7:20 am, edited 1 time in total.
~ Dream
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

simpy use the correct enumeration for the mouse event and not the one for key input... ;)

Code: Select all

Enumeration values: 
EMIE_LMOUSE_PRESSED_DOWN  Left mouse button was pressed down.  
EMIE_RMOUSE_PRESSED_DOWN  Right mouse button was pressed down.  
EMIE_MMOUSE_PRESSED_DOWN  Middle mouse button was pressed down.  
EMIE_LMOUSE_LEFT_UP  Left mouse button was left up.  
EMIE_RMOUSE_LEFT_UP  Right mouse button was left up.  
EMIE_MMOUSE_LEFT_UP  Middle mouse button was left up.  
EMIE_MOUSE_MOVED  The mouse cursor changed its position.  
EMIE_MOUSE_WHEEL  The mouse wheel was moved. Use Wheel value in event data to find out in what direction and how fast.  
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
~ Dream
Posts: 12
Joined: Fri Jun 29, 2007 11:28 am
Location: The Dream World

Post by ~ Dream »

thanks. It work :)
~ Dream
Post Reply