本文整理汇总了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;
}
示例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);
}
}
示例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();
}