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


C++ Entity::AttachChild方法代码示例

本文整理汇总了C++中Entity::AttachChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::AttachChild方法的具体用法?C++ Entity::AttachChild怎么用?C++ Entity::AttachChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entity的用法示例。


在下文中一共展示了Entity::AttachChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddLevel

Entity* LevelSelectObject::AddLevel(const char * name, const char * level, const Vector2 & position, Entity* owner)
{
	Entity* entity = owner->AttachChild(EntityFactory::CreateGraphic(position, size + stroke, NULL, Vector4(0, 0, 0)));
	entity->AttachChild(EntityFactory::CreateGraphic(Vector2(0, size.y * 0.3f), Vector2(size.x, size.y * 0.4f), NULL, Vector4(1, 1, 1, 0.1f), 1));

	entity = entity->AttachChild(EntityFactory::CreateCSVGraphic(Vector2(), size, ToString("Data//Levels//", level, ".csv").c_str(), Vector4(1, 1, 1)));

	if (!string(name).empty())
	{
		entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(0, size.y * 0.5f), name, 300))
			->GetComponent<TextRenderer2D>()->color.Set(0.75f, 0.75f, 0);
	}

	return entity;
}
开发者ID:Dopelust,项目名称:SP4-10,代码行数:15,代码来源:LevelSelectObject.cpp

示例2: Init

void StageGUI::Init(Entity * ent)
{
	stage = ent->GetComponent<StageManager>();

	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(GridWidth * 0.5f, Screen.GetProjectionHeight() * 0.55f), "", 400);
		indicator = entity->GetComponent<TextRenderer2D>();
		indicator->color.w = 0;
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(140, TileHeight * 0.5f), "", 200);
		timer = entity->GetComponent<TextRenderer2D>();
		timer->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(16, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 256);
		wave = entity->GetComponent<TextRenderer2D>();
		wave->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(200, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 200);
		health = entity->GetComponent<TextRenderer2D>();
		health->color.Set(1, 0, 0);
		health->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateTextGUI(Vector2(300, Screen.GetProjectionHeight() - TileHeight * 0.5f), "", 200);
		gold = entity->GetComponent<TextRenderer2D>();
		gold->color.Set(1, 1, 0);
		gold->SetAlignCenter(false);
	}
	{
		Entity* entity = EntityFactory::GenerateButton(Vector2(64, TileHeight * 0.5f), Vector2(128, TileHeight), NULL, Vector3(0.5f, 0.5f, 0.5f), true);
		pause = entity->GetComponent<Button>();
		pause->SetKey(' ');
		pause->text = entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "START", 200))->GetComponent<TextRenderer2D>();
	}
	{
		Entity* entity = EntityFactory::GenerateButton(Vector2(Screen.GetProjectionWidth() - TileWidth * 0.5f, Screen.GetProjectionHeight() - TileHeight * 0.5f), Vector2(TileWidth, TileHeight), NULL, Vector3(0.7f, 0, 0), true);
		entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "X", 300));
		quit = entity->GetComponent<Button>();

		quitPopup = EntityFactory::GeneratePopup(Vector2(300, 150), "", 150);
	}
}
开发者ID:Dopelust,项目名称:SP4-10,代码行数:45,代码来源:StageGUI.cpp

示例3: Init

void PlayState::Init()
{
	glClearColor(0.2, 0.2, 0.2, 1);

	scene = new Scene(NULL);

	Entity* entity = EntityFactory::GenerateButton(Vector2(200, 200), Vector2(200, 100), NULL, Vector3(0.5f, 0.5f, 0.5f));
	entity->AttachChild(EntityFactory::CreateTextGUI(Vector2(), "Return", 128));
	menu = entity->GetComponent<Button>();

	Resume();
}
开发者ID:Dopelust,项目名称:SP4-10,代码行数:12,代码来源:TemplateState.cpp


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