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)); }
void InsertObjectCmd::DoExecute() { m_parent->AddChild(m_object); m_object->SetParent(m_parent); if (m_pos >= 0) m_parent->ChangeChildPosition(m_object,m_pos); }
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); }
void CutObjectCmd::DoRestore() { // reubicamos el objeto donde estaba m_parent->AddChild(m_object); m_object->SetParent(m_parent); m_parent->ChangeChildPosition(m_object,m_oldPos); // restauramos el clipboard //m_data->SetClipboardObject(m_clipboard); m_data->SetClipboardObject(shared_ptr<ObjectBase>()); m_data->SelectObject(m_oldSelected); }
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); }
void ReparentObjectCmd::DoRestore() { m_sizer->RemoveChild(m_sizeritem); m_sizeritem->SetParent(m_oldSizer); m_oldSizer->AddChild(m_sizeritem); }