当前位置: 首页>>代码示例>>C++>>正文


C++ Label::Initialize方法代码示例

本文整理汇总了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);
}
开发者ID:Harteex,项目名称:ExLauncher,代码行数:18,代码来源:TabStrip.cpp

示例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)
//.........这里部分代码省略.........
开发者ID:Blinkk,项目名称:Kings_Truth_v2.0,代码行数:101,代码来源:UIManager.cpp


注:本文中的Label::Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。