hi,
my event for which I react is the following:
Code: Select all
if (event.EventType == EET_MOUSE_INPUT_EVENT && event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
core::position2di pos(event.MouseInput.X, event.MouseInput.Y);
core::line3d<f32> ray;
ray.start = admin.camera->getPosition();
ray.end = ray.start + (admin.camera->getTarget() - ray.start).normalize() * 1000.0f;
core::line3d<f32> line;
line.start = camera->getPosition();
line.end = line.start + (camera->getTarget() - line.start).normalize() * 1000.0f;
// Tracks the current intersection point with the level or a mesh
core::vector3df intersection;
// Used to show which triangle has been hit
core::triangle3df hitTriangle;
Selected = SceneManager->getSceneCollisionManager()->getSceneNodeAndCollisionPointFromRay(ray,intersection,hitTriangle,0,0,false);
}
So I'm pressing the left mouse button, I select an octree, which has an ID. I'm checking this ID, and if the selected ID is the one I was searching for, message box appears with the successful text.
Code: Select all
MyEventReceiver receiver(smgr);
device->setEventReceiver(&receiver);
while(device->run())
{
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
env->drawAll();
// other code, not relevant here
if (receiver.Selected && windowIsOnTheScreen == false )
{
s32 id;
id = receiver.Selected->getID();
int _found = 0;
if ( id == 2000 )
{
// do something
_found = 1;
}
if ( _found ) // clicking inside the room. if the room's ID (ID of the mesh) equals to some integer, _found = 1
{
env->addMessageBox( L"Congratulations!" , L"You found the correct room!" , true , EMBF_OK , 0 , 404 , 0 );
if ( admin.camera )
admin.camera->setInputReceiverEnabled ( !admin.camera->isInputReceiverEnabled() );
windowIsOnTheScreen = true;
}
}
And here is the code for clicking on the YES of buttonId = 404
Code: Select all
case EGET_MESSAGEBOX_OK:
if ( id == 404 )
{
if ( admin.camera )
admin.camera->setInputReceiverEnabled ( !admin.camera->isInputReceiverEnabled() );
windowIsOnTheScreen = false;
break;
}
What I try to achieve is to close only the message box, and do not make an octree selection behind the messagebox. Because currently this is happenning. If there is an octree behind the messagebox, after clicking on the OK button of the messagebox, the messagebox closes, but the clicking is also accepted by the eventmanager, so an another messagebox appears again... that happens like an infinite loop.