Catch mouse click after all GUI handled
Posted: Tue Sep 08, 2009 8:47 pm
Hello again from my newbie questions.
Help me to think how to easier catch mouse click event after GUI handled, i.e. unless any GUI event respond click.
The only thing came in mind to include some variable, turn it on, when lmb clicked and turn off on any GUI event. Then it can be catched in (1)
May be it can be done some easier approach?
Help me to think how to easier catch mouse click event after GUI handled, i.e. unless any GUI event respond click.
The only thing came in mind to include some variable, turn it on, when lmb clicked and turn off on any GUI event. Then it can be catched in (1)
Code: Select all
bool terrainClicked = false;
main.cpp:
...
while( device->run() )
if ( device->isWindowActive() )
{
driver->beginScene( true, true, SColor( 255, 100, 100, 150 ) );
scMgr->drawAll();
guiEnv->drawAll();
driver->endScene();
if( terrainClicked )
onTerrainClick(); /*** (1) ***/
terrainClicked = false;
}
...
CMyEventReceiver
{
bool OnEvent( SEvent& _event)
{
switch( _event.EventType )
{
case EET_GUI_EVENT:
terrainClicked = false;
...
case EET_MOUSE_INPUT_EVENT:
switch( _event.MouseInput.Event )
{
case EMIE_LMOUSE_PRESSED_DOWN:
terrainClicked = true;
}
}
}
};