本文整理汇总了C++中cegui::Window::getArea方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getArea方法的具体用法?C++ Window::getArea怎么用?C++ Window::getArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getArea方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tick
void CCreditosState::tick(unsigned int msecs)
{
CApplicationState::tick(msecs);
CEGUI::Window* creditos = CEGUI::System::getSingletonPtr()->getDefaultGUIContext().getRootWindow()->getChild("texto");
float y = creditos->getArea().getPosition().d_y.d_scale;
float alt = y + creditos->getArea().getHeight().d_scale;
float x = creditos->getArea().getPosition().d_x.d_scale;
float ancho = x + creditos->getArea().getWidth().d_scale;
creditos->setProperty("Area","{{"+std::to_string(x)+
",0},{"+std::to_string(y-0.0008)+",0},{"+std::to_string(ancho)+",0},{"
+std::to_string(alt-0.0008)+",0}}");
creditos = CEGUI::System::getSingletonPtr()->getDefaultGUIContext().getRootWindow()->getChild("sai");
y = creditos->getArea().getPosition().d_y.d_scale;
alt = y + creditos->getArea().getHeight().d_scale;
x = creditos->getArea().getPosition().d_x.d_scale;
ancho = x + creditos->getArea().getWidth().d_scale;
creditos->setProperty("Area","{{"+std::to_string(x)+
",0},{"+std::to_string(y-0.0008)+",0},{"+std::to_string(ancho)+",0},{"
+std::to_string(alt-0.0008)+",0}}");
} // tick
示例2: AlignSelection
//------------------------------------------------------------------------
void SelectionMover::AlignSelection(const Alignment alignment)
{
// Validations
wxASSERT_MSG(m_selection != NULL, wxT("Selection member is NULL"));
if(m_selection->Size() <= 1)
{
// Should not happen because of the disabled menu/toolbar item in this case
LogWarning(wxT("You must select more than one window to align!"));
return;
}
// The first selected window is the one to match. This is for example how Visual Studio's
// dialog editor works as well.
Selection::Boxes::iterator boxIt = m_selection->GetMoveableBoxes().begin();
CEGUI::Window *current = boxIt->GetWindow();
const CEGUI::URect rect = current->getArea();
++boxIt;
for(; boxIt != m_selection->GetMoveableBoxes().end(); ++boxIt) {
// Deny when it is blocked
if (boxIt->IsLocked())
continue;
current = boxIt->GetWindow();
switch(alignment)
{
case AlignLeft:
current->setPosition(CEGUI::UVector2(rect.d_min.d_x, current->getPosition().d_y));
break;
case AlignRight:
current->setPosition(CEGUI::UVector2(rect.d_max.d_x - current->getWidth(), current->getPosition().d_y));
break;
case AlignTop:
current->setPosition(CEGUI::UVector2(current->getPosition().d_x, rect.d_min.d_y));
break;
case AlignBottom:
current->setPosition(CEGUI::UVector2(current->getPosition().d_x, rect.d_max.d_y - current->getHeight()));
break;
case AlignWidth:
// The svn diff for this block will be big; no clue what the previous code
// was doing there..
current->setWidth(rect.getWidth());
break;
case AlignHeight:
// The svn diff for this block will be big; no clue what the previous code
// was doing there..
current->setHeight(rect.getHeight());
break;
default:
LogError(wxT("SelectionMover::AlignSelection - Unrecognized align option (%d)"), alignment);
return;
}
}
// Request for a repaint
wxGetApp().GetMainFrame()->Refresh();
}
示例3: AlignSpaceBetween
//nikai 2010.9.3
void SelectionMover::AlignSpaceBetween(int PaddingValue, const PaddingAlign al)
{
// Validations
wxASSERT_MSG(m_selection != NULL, wxT("Selection member is NULL"));
if(m_selection->Size() <= 1)
{
// Should not happen because of the disabled menu/toolbar item in this case
LogWarning(wxT("You must select more than one window to align!"));
return;
}
// The first selected window is the one to match. This is for example how Visual Studio's
// dialog editor works as well.
Selection::Boxes::iterator boxIt = m_selection->GetMoveableBoxes().begin();
const CEGUI::Window *current = boxIt->GetWindow();
CEGUI::Window *pParentWin = current->getParent();
if(NULL == pParentWin)
{
LogWarning(wxT("You can't operate the root window!"));
wxMessageBox(L"You can't operate the root window!");
return;
}
const long ParentX = CEGUI::CoordConverter::windowToScreenX(*pParentWin,0);
const long ParentY = CEGUI::CoordConverter::windowToScreenY(*pParentWin,0);
const long parentWidth = pParentWin->getPixelSize().d_width;
const long parentHeight = pParentWin->getPixelSize().d_height;
const CEGUI::URect rect = current->getArea();
++boxIt;
for(; boxIt != m_selection->GetMoveableBoxes().end(); ++boxIt) {
// Deny when it is blocked
if (boxIt->IsLocked())
{
wxMessageBox(L"all the select window ¡¯s can't be locked£¡");
return;
}
CEGUI::Window* curWin = boxIt->GetWindow();
if (pParentWin != curWin->getParent())
{
wxMessageBox(L"all the select window ¡¯s parent must be same£¡");
return;
}
}
//»Ö¸´µü´úÆ÷λÖÃ
//boxIt = m_selection->GetMoveableBoxes().begin();
//++boxIt;
//float lWidth = current->getPixelSize().d_width;
//float lHeight = current->getPixelSize().d_height;
//float RightPos = CEGUI::CoordConverter::windowToScreenX(*current,0)+lWidth;
//float BottomPos = CEGUI::CoordConverter::windowToScreenY(*current,0)+lHeight;
//
//for(; boxIt != m_selection->GetMoveableBoxes().end(); ++boxIt)
//{
// CEGUI::Window* curWin = boxIt->GetWindow();
// CEGUI::UDim xPos = curWin->getXPosition();
// CEGUI::UDim yPos = curWin->getYPosition();
// switch(al)
// {
// case HorzPadding:
// {
// float newXPixel = RightPos + PaddingValue;
// float xscale = (newXPixel-ParentX)/parentWidth;
// xPos = CEGUI::UDim(xscale,0);
// break;
// }
// case VertPadding:
// {
// float newYPixel = BottomPos + PaddingValue;
// float yscale = (newYPixel-ParentY)/parentHeight;
// yPos = CEGUI::UDim(yscale,0);
// break;
// }
// default:
// LogError(wxT("SelectionMover::AlignSelection - Unrecognized align option (%d)"), al);
// return;
// }
// curWin->setPosition(CEGUI::UVector2(xPos,yPos));
// lWidth = curWin->getPixelSize().d_width;
// lHeight = curWin->getPixelSize().d_height;
// RightPos = CEGUI::CoordConverter::windowToScreenX(*curWin,0)+lWidth;
// BottomPos = CEGUI::CoordConverter::windowToScreenY(*curWin,0)+lHeight;
//}
//// Request for a repaint
//wxGetApp().GetMainFrame()->Refresh();
boxIt = m_selection->GetMoveableBoxes().begin();
++boxIt;
float newPixelWidth = current->getPixelSize().d_width;
float newPixelHeight = current->getPixelSize().d_height;
float RightPos = CEGUI::CoordConverter::windowToScreenX(*current,0)+newPixelWidth;
float BottomPos = CEGUI::CoordConverter::windowToScreenY(*current,0)+newPixelHeight;
for(; boxIt != m_selection->GetMoveableBoxes().end(); ++boxIt)
{
CEGUI::Window* curWin = boxIt->GetWindow();
float fLeft = CEGUI::CoordConverter::windowToScreenX(*curWin,0);
float fTop = CEGUI::CoordConverter::windowToScreenY(*curWin,0);
//.........这里部分代码省略.........