本文整理汇总了C++中UIControl::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ UIControl::GetSize方法的具体用法?C++ UIControl::GetSize怎么用?C++ UIControl::GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIControl
的用法示例。
在下文中一共展示了UIControl::GetSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateCellSize
void EditorListDelegate::UpdateCellSize(UIList *forList)
{
if (isElementsCountNeedUpdate && forList)
{
isElementsCountNeedUpdate = false;
// Change cell size only if aggregator control is available
UIControl *aggregatorControl = GetCurrentAggregatorControl();
if (aggregatorControl)
{
Vector2 aggregatorSize = aggregatorControl->GetSize();
SetCellSize(aggregatorSize);
}
Vector2 listSize = forList->GetSize();
if(forList->GetOrientation() == UIList::ORIENTATION_HORIZONTAL)
{
DVASSERT(cellSize.x > 0);
cellsCount = ceilf( listSize.x / cellSize.x );
}
else
{
DVASSERT(cellSize.y > 0);
cellsCount = ceilf( listSize.y / cellSize.y );
}
}
}
示例2: LoadResources
void FormatsTest::LoadResources()
{
GetBackground()->SetColor(Color(0.0f, 1.0f, 0.0f, 1.0f));
int32 columnCount = 6;
int32 rowCount = (FORMAT_COUNT-1) / columnCount;
if(0 != FORMAT_COUNT % columnCount)
{
++rowCount;
}
float32 size = Min(GetSize().x / columnCount, GetSize().y / rowCount);
Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
DVASSERT(font);
font->SetSize(20);
for(int32 i = FORMAT_RGBA8888; i < FORMAT_COUNT; ++i)
{
int32 y = (i-1) / columnCount;
int32 x = (i-1) % columnCount;
String formatName = Texture::GetPixelFormatString((PixelFormat)i);
UIControl *c = new UIControl(Rect(x*size, y*size, size - 2, size - 2));
c->SetSprite(Format("~res:/TestData/FormatTest/%s/number_0", formatName.c_str()), 0);
c->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
UIStaticText *text = new UIStaticText(Rect(0, c->GetSize().y - 30, c->GetSize().x, 30));
text->SetText(StringToWString(formatName));
text->SetFont(font);
text->SetTextColor(Color(1.0f, 1.0f, 1.0f, 1.0f));
c->AddControl(text);
AddControl(c);
SafeRelease(text);
SafeRelease(c);
}
SafeRelease(font);
}