//--------------------------------------------------------------------------- MouseEventResult SelectingObjectsWithMouse::mousePressed( const MouseEvent& _evt ) { World* world = WorldManager::getSingleton().getActiveWorld(); if(!world) return MouseEventResult::NOT_PROCESSED; Camera* camera = world->getCamera(); SceneManagerEx* sm = world->getSceneManager(); RaySceneQueryExPtr q = sm->createRayQueryEx(_evt.getAbsX(), _evt.getAbsY(), world->getViewportAbsCoord(), camera); q->setQueryTypeMask( SceneQueryMask::VOB | SceneQueryMask::INVISIBLE_IN_GAME ); q->setMaxResults(1); RaySceneQueryExResult& result = q->execute(); world->deselectAll(); if(!result.empty()) { WorldObject* worldObject = WorldObject::getFromMovableObject(result.front().movable); if(worldObject) worldObject->select(); } return MouseEventResult::PROCESSED; }
//------------------------------------------------------------------------------- MouseEventResult MyGUIInput::mouseMoved( const MouseEvent& _evt ) { MyGUI::PointerManager::getInstance().setVisible(true); if(MyGUI::InputManager::getInstance().injectMouseMove( _evt.getAbsX(), _evt.getAbsY(), _evt.getAbsZ())) { MyGUI::Widget* focusWidget = MyGUI::InputManager::getInstance().getMouseFocusWidget(); if(focusWidget && canWidgetProcessMouse(focusWidget)) return MouseEventResult::PROCESSED; } if(MyGUI::InputManager::getInstance().isModalAny()) return MouseEventResult::PROCESSED; return MouseEventResult::NOT_PROCESSED; }
//------------------------------------------------------------------------------- MouseEventResult MyGUIInput::mouseReleased( const MouseEvent& _evt ) { if(MyGUI::InputManager::getInstance().injectMouseRelease( _evt.getAbsX(), _evt.getAbsY(), MyGUIInputConv::mouseButtonToMyGUI(_evt.getMouseButton()))) { MyGUI::Widget* focusWidget = MyGUI::InputManager::getInstance().getMouseFocusWidget(); if(focusWidget && canWidgetProcessMouse(focusWidget)) { releaseMouse(); return MouseEventResult::PROCESSED; } } if(MyGUI::InputManager::getInstance().isModalAny()) return MouseEventResult::PROCESSED; return MouseEventResult::NOT_PROCESSED; }