I try to find out, if I hit the gui with the mouse. The code below works good so far. The problem is when I click the mouse, while hovering on a submenu.
When the mouse clicks, the root gui element gets returned, not the actual menu or context menu.
Thanks in advance, here's the code:
Code: Select all
if(event.EventType == irr::EET_MOUSE_INPUT_EVENT &&
(event.MouseInput.Event == irr::EMIE_LMOUSE_LEFT_UP ||
event.MouseInput.Event == irr::EMIE_LMOUSE_PRESSED_DOWN ||
event.MouseInput.Event == irr::EMIE_RMOUSE_LEFT_UP ||
event.MouseInput.Event == irr::EMIE_MMOUSE_LEFT_UP||
event.MouseInput.Event == irr::EMIE_MMOUSE_PRESSED_DOWN))
{
// if gui was hit, dont process event
irr::gui::IGUIElement * elem = m_pEnv->getRootGUIElement()->getElementFromPoint
(irr::core::position2d<irr::s32>(event.MouseInput.X, event.MouseInput.Y));
if(elem != m_pEnv->getRootGUIElement())
{
return false;
}
}