CUiButton::CUiButton(std::string name) : CUiElement(name), m_rectangle(name + ":rect"), m_text(name + ":text") { m_properties.add_properties({ "textColor", "text", "font", "backgroundColor", "borderRadius" }); // Copy default properties from components. CopyProperties(&m_text, this, { "textColor", "text", "font" }); CopyProperties(&m_rectangle, this, { "backgroundColor", "borderRadius" }); // Set text in from rectangle. m_text.SetProperty("margin", margin_t<float>{ 10, 10, 10, 10 }); }
void CUiButton::DrawElement(cairo_t* cr) const { // Set rectangle geometry from button. m_rectangle.SetProperty("geometry", m_extent); CopyProperties(this, &m_rectangle, { "backgroundColor", "borderRadius" }); m_rectangle.Draw(cr); m_text.SetProperty("geometry", m_extent); CopyProperties(this, &m_text, { "textColor", "text", "font" }); m_text.Draw(cr); DrawChildren(cr); }
nuiSerializeContext::nuiSerializeContext(const nuiSerializeContext& rContext) { mpNode = rContext.mpNode; mRecursive = rContext.mRecursive; mOperation = rContext.mOperation; CopyProperties(rContext); }
void Text::ClearContext() { if (m_context.scene) { m_context.scene->GetEntities<gxeng::ITextEntity>().Remove(m_entity.get()); } auto newEntity = std::make_unique<PlaceholderTextEntity>(); CopyProperties(*m_entity, *newEntity); m_entity = std::move(newEntity); m_context = { nullptr, nullptr }; }
APlayerState* APlayerState::Duplicate() { FActorSpawnParameters SpawnInfo; SpawnInfo.Instigator = Instigator; SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; SpawnInfo.ObjectFlags |= RF_Transient; // We never want to save player states into a map APlayerState* NewPlayerState = GetWorld()->SpawnActor<APlayerState>(GetClass(), SpawnInfo ); // Can fail in case of multiplayer PIE teardown if (NewPlayerState) { CopyProperties(NewPlayerState); } return NewPlayerState; }
void Text::SetContext(const GraphicsContext& context) { assert(context.engine); assert(context.scene); if (m_context.scene) { m_context.scene->GetEntities<gxeng::ITextEntity>().Remove(m_entity.get()); } std::unique_ptr<gxeng::ITextEntity> newEntity(context.engine->CreateTextEntity()); CopyProperties(*m_entity, *newEntity); m_entity = std::move(newEntity); m_context = context; m_context.scene->GetEntities<gxeng::ITextEntity>().Add(m_entity.get()); }
void APlayerState::SeamlessTravelTo(APlayerState* NewPlayerState) { CopyProperties(NewPlayerState); NewPlayerState->bOnlySpectator = bOnlySpectator; }
CHTMLFont & CHTMLFont::operator =(const CHTMLFont & fnt) { if ( this != &fnt ) CopyProperties(fnt); return *this; }
CHTMLFont::CHTMLFont(const CHTMLFont & fnt) { CopyProperties(fnt); }
void Packet::TransferProperties(Packet& pSrc, bool pValidateStartTime, bool pResetClipInfo) { CopyProperties(pSrc, pValidateStartTime); pSrc.ResetProperties(pResetClipInfo); }
Text::Text(const Text& other) { m_entity = std::make_unique<PlaceholderTextEntity>(); assert(other.m_entity); CopyProperties(*other.m_entity, *m_entity); }