本文整理汇总了C++中cegui::Window::getAbsolutePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getAbsolutePosition方法的具体用法?C++ Window::getAbsolutePosition怎么用?C++ Window::getAbsolutePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getAbsolutePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveWindow
//只改变位置不改变大小
void CUIEditorView::moveWindow(CPoint point,CPoint step,CEGUI::Window* pWin/* = NULL*/)
{
CEGUI::Window* pWindow = pWin ? pWin : m_pSelectedWindow;
if (pWindow)
{
//方向键操作
if ( step.x != 0 || step.y != 0 )
{
CEGUI::Point pos = pWindow->getAbsolutePosition();
pos.d_x += step.x;
pos.d_y += step.y;
pWindow->setPosition(CEGUI::Absolute, pos);
}
//鼠标操作
else
{
CEGUI::Window* pParent = pWindow;
CEGUI::Point pt = CEGUI::Point(point.x, point.y);
if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet())
{
pParent = pWindow->getParent();
CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
//初始化位置
if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
{
m_ptMouseMovePos.x = point.x - pointWindow.d_x;
m_ptMouseMovePos.y = point.y - pointWindow.d_y;
}
pt.d_x -= m_ptMouseMovePos.x;
pt.d_y -= m_ptMouseMovePos.y;
}
else
{
while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet())
{
pParent = pParent->getParent();
}
CEGUI::Point pointParent = pParent->getPixelRect().getPosition();
CEGUI::Point pointWindow = pWindow->getPixelRect().getPosition();
//初始化位置
if(m_ptMouseMovePos.x == 0 && m_ptMouseMovePos.y == 0)
{
m_ptMouseMovePos.x = point.x - pointWindow.d_x;
m_ptMouseMovePos.y = point.y - pointWindow.d_y;
}
pt = CEGUI::Point(point.x-pointParent.d_x /*+pointWindow.d_x*/ - m_ptMouseMovePos.x,
point.y - pointParent.d_y/* +pointWindow.d_y*/ - m_ptMouseMovePos.y);
}
pWindow->setClippedByParent(true);
pWindow->setPosition(CEGUI::Absolute, pt);
}
}
}