本文整理汇总了C++中cegui::Window::getChildAtPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getChildAtPosition方法的具体用法?C++ Window::getChildAtPosition怎么用?C++ Window::getChildAtPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getChildAtPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
int x = ea.getX(), y = ea.getY(), width = ea.getWindowWidth(), height = ea.getWindowHeight();
if ( ea.getMouseYOrientation()==osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS )
y = ea.getWindowHeight() - y;
if ( !CEGUI::System::getSingletonPtr() )
return false;
CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
switch ( ea.getEventType() )
{
case osgGA::GUIEventAdapter::KEYDOWN:
context.injectKeyDown(key_conv(ea.getKey()));
context.injectChar(char_conv(ea.getKey()));
// return key_conv(ea.getKey()) != CEGUI::Key::Unknown;
break;
case osgGA::GUIEventAdapter::KEYUP:
context.injectKeyUp(key_conv(ea.getKey()));
// return key_conv(ea.getKey()) != CEGUI::Key::Unknown;
break;
case osgGA::GUIEventAdapter::PUSH:
context.injectMousePosition( x, y );
context.injectMouseButtonDown(convertMouseButton(ea.getButton()));
break;
case osgGA::GUIEventAdapter::RELEASE:
context.injectMousePosition(x, y);
context.injectMouseButtonUp(convertMouseButton(ea.getButton()));
break;
case osgGA::GUIEventAdapter::SCROLL:
if ( ea.getScrollingMotion()==osgGA::GUIEventAdapter::SCROLL_DOWN )
context.injectMouseWheelChange(-1);
else if ( ea.getScrollingMotion()==osgGA::GUIEventAdapter::SCROLL_UP )
context.injectMouseWheelChange(+1);
break;
case osgGA::GUIEventAdapter::DRAG:
case osgGA::GUIEventAdapter::MOVE:
context.injectMousePosition(x, y);
break;
case osgGA::GUIEventAdapter::RESIZE:
if ( _camera.valid() )
{
_camera->setProjectionMatrix( osg::Matrixd::ortho2D(0.0, width, 0.0, height) );
_camera->setViewport( 0.0, 0.0, width, height );
}
break;
default:
return false;
}
CEGUI::Window* rootWindow = context.getRootWindow();
if ( rootWindow )
{
CEGUI::Window* anyWindow = rootWindow->getChildAtPosition( CEGUI::Vector2f(x, y) );
if ( anyWindow ) return true;
}
return false;
}