MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / EnableBackground

Method EnableBackground

SDK/src/NDK/BaseWidget.cpp:64–86  ·  view source on GitHub ↗

! * \brief Enable or disables the widget background. */

Source from the content-addressed store, hash-verified

62 * \brief Enable or disables the widget background.
63 */
64 void BaseWidget::EnableBackground(bool enable)
65 {
66 if (m_backgroundEntity.IsValid() == enable)
67 return;
68
69 if (enable)
70 {
71 m_backgroundSprite = Nz::Sprite::New();
72 m_backgroundSprite->SetColor(m_backgroundColor);
73 m_backgroundSprite->SetMaterial(Nz::Material::New((m_backgroundColor.IsOpaque()) ? "Basic2D" : "Translucent2D"));
74
75 m_backgroundEntity = CreateEntity();
76 m_backgroundEntity->AddComponent<GraphicsComponent>().Attach(m_backgroundSprite, -1);
77 m_backgroundEntity->AddComponent<NodeComponent>().SetParent(this);
78
79 BaseWidget::Layout(); // Only layout background
80 }
81 else
82 {
83 m_backgroundEntity->Kill();
84 m_backgroundSprite.Reset();
85 }
86 }
87
88 void BaseWidget::GrabKeyboard()
89 {

Callers

nothing calls this directly

Calls 7

AttachMethod · 0.80
SetParentMethod · 0.80
KillMethod · 0.80
IsValidMethod · 0.45
SetColorMethod · 0.45
SetMaterialMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected