本文整理汇总了C++中Label::Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::Initialize方法的具体用法?C++ Label::Initialize怎么用?C++ Label::Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddTab
void TabStrip::AddTab(string name)
{
Label* label = new Label();
label->SetSize(tabSize);
label->SetLayoutMargin(Box(0, 0, 10, 10));
label->SetGravity(GRAVITY_VCENTER | GRAVITY_HCENTER);
label->SetText(name);
label->SetParentView(this);
label->SetRelativePosition(0, 0);
label->SetTextSize(18);
if (IsInitialized())
{
label->Initialize(context);
label->CalculateLayout(Size(-1, -1));
}
tabs.push_back(label);
}
示例2: Standard_Gameplay_UI
//////////////////////////////
// Level load Functions - UI
//////////////////////////////
void UIManager::Standard_Gameplay_UI()
{
std::vector<IUI_Object*> uiObjects;
//////////////////////////////////////////////////////////////
// Create UI objects for this setup (STANDARD_GAMEPLAY_UI)
//
// Note: This requires that there be an active camera set in
// the g_Engine global reference.
//////////////////////////////////////////////////////////////
if (g_Engine->GetActiveCamera() != nullptr)
{
// Set up label dimensions and offset
float lWidth = 200.0f;
float lHeight = 75.0f;
float offsetX = -((SCREENW / 2) * g_Engine->GetActiveCamera()->GetZoomFactor()) + 10;
float offsetY = -((SCREENH / 2) * g_Engine->GetActiveCamera()->GetZoomFactor()) + 7.5f;
#pragma region UIObjectCreation
Label* pTemp = g_Engine->GetFactory()->CreateObject<Label>();
if (pTemp)
{
pTemp->Initialize("Calibri", 10, offsetX, offsetY,
"Health: ", LABELTEXTURES::STANDARD_LABEL_TEXTURE);
// Health label
Label* pTempLabel = g_Engine->GetFactory()->CreateObject<Label>();
if (pTempLabel)
{
pTempLabel->Initialize("Calibri", 14, offsetX, offsetY,
"Health:", LABELTEXTURES::STANDARD_LABEL_TEXTURE);
uiObjects.push_back(pTempLabel);
pTempLabel = nullptr;
}
else
debug << "\tFailed to create 'Label - Health' in STANDARD_GAMEPLAY_UI" << std::endl;
// Hearts - 1
PicBox* pTempPic = g_Engine->GetFactory()->CreateObject<PicBox>();
if (pTempPic)
{
offsetX += 40;
pTempPic->Initialize(16, 16, offsetX, offsetY,
true, "heart.png", "heart");
uiObjects.push_back(pTempPic);
pTempPic = nullptr;
}
else
debug << "\tFailed to create 'PicBox - Heart' in STANDARD_GAMEPLAY_UI" << std::endl;
// Hearts - 2
pTempPic = g_Engine->GetFactory()->CreateObject<PicBox>();
if (pTempPic)
{
offsetX += 16;
pTempPic->Initialize(16, 16, offsetX, offsetY,
true, "heart.png", "heart");
uiObjects.push_back(pTempPic);
pTempPic = nullptr;
}
else
debug << "\tFailed to create 'PicBox - Heart' in STANDARD_GAMEPLAY_UI" << std::endl;
// Hearts - 3
pTempPic = g_Engine->GetFactory()->CreateObject<PicBox>();
if (pTempPic)
{
offsetX += 16;
pTempPic->Initialize(16, 16, offsetX, offsetY,
true, "heart.png", "heart");
uiObjects.push_back(pTempPic);
pTempPic = nullptr;
}
else
debug << "\tFailed to create 'PicBox - Heart' in STANDARD_GAMEPLAY_UI" << std::endl;
// Hearts - 4
pTempPic = g_Engine->GetFactory()->CreateObject<PicBox>();
if (pTempPic)
{
offsetX += 16;
pTempPic->Initialize(16, 16, offsetX, offsetY,
true, "heart.png", "heart");
uiObjects.push_back(pTempPic);
pTempPic = nullptr;
}
else
debug << "\tFailed to create 'PicBox - Heart' in STANDARD_GAMEPLAY_UI" << std::endl;
// Hearts - 5
pTempPic = g_Engine->GetFactory()->CreateObject<PicBox>();
if (pTempPic)
//.........这里部分代码省略.........