本文整理汇总了C++中shared_ptr::AddChild方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::AddChild方法的具体用法?C++ shared_ptr::AddChild怎么用?C++ shared_ptr::AddChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::AddChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnStart
void OnStart()
{
auto scene = make_shared<Scene>();
auto layer = make_shared<Layer2D>();
auto child = make_shared<TextureObject2D>();
auto child2 = make_shared<TextureObject2D>();
m_parent = make_shared<TextureObject2D>();
auto file = asd::Engine::GetFile();
file->AddRootDirectory(asd::ToAString("Data/Texture").c_str());
asd::Engine::ChangeScene(scene);
scene->AddLayer(layer);
layer->AddObject(m_parent);
layer->AddObject(child);
layer->AddObject(child2);
m_parent->AddChild(child, ChildMode::All);
child->AddChild(child2, ChildMode::Nothing);
auto g = asd::Engine::GetGraphics();
auto texture = g->CreateTexture2D(asd::ToAString("Cloud1.png").c_str());
m_parent->SetTexture(texture);
child->SetTexture(texture);
child2->SetTexture(texture);
m_parent->SetPosition(Vector2DF(320, 240));
m_parent->SetCenterPosition(Vector2DF(128, 128));
m_parent->SetColor(Color(255, 255, 128, 255));
child->SetPosition(Vector2DF(50, 50));
child2->SetPosition(Vector2DF(60, 60));
}
示例2: DoExecute
void InsertObjectCmd::DoExecute()
{
m_parent->AddChild(m_object);
m_object->SetParent(m_parent);
if (m_pos >= 0)
m_parent->ChangeChildPosition(m_object,m_pos);
}
示例3: DoRestore
void RemoveObjectCmd::DoRestore()
{
m_parent->AddChild(m_object);
m_object->SetParent(m_parent);
// restauramos la posición
m_parent->ChangeChildPosition(m_object,m_oldPos);
m_data->SelectObject(m_oldSelected);
}
示例4: OnStart
void OnStart()
{
obj = make_shared<TextureObject2D>();
obj->SetPosition(Vector2DF(200, 200));
obj->SetTexture(Engine::GetGraphics()->CreateTexture2D(ToAString("Data/Texture/Cloud1.png").c_str()));
Engine::AddObject2D(obj);
child = make_shared<TextureObject2D>();
child->SetPosition(Vector2DF(10, 10));
child->SetTexture(Engine::GetGraphics()->CreateTexture2D(ToAString("Data/Texture/Cloud1.png").c_str()));
obj->AddChild(child, asd::ChildMode::Position);
Engine::AddObject2D(child);
}