diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2022-11-16 08:11:00 -0500 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2022-11-16 08:19:53 -0500 |
commit | 034c802edd39be537a626c1961272a6137b5980e (patch) | |
tree | d9b042878d8a8f573cf09744814270a32b920b89 /src/ui.cpp | |
parent | f892f3c3afb4a3795dc3ba5c26cacd1f8088b902 (diff) |
text clears with dialog box
Diffstat (limited to 'src/ui.cpp')
-rw-r--r-- | src/ui.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -8,8 +8,9 @@ static const unsigned int NRE_TEX_DATA = 0xBBBBBBBB; -void UISystem::configure(entityx::EntityManager&, entityx::EventManager&) +void UISystem::configure(entityx::EntityManager&, entityx::EventManager &events) { + events.subscribe<HideDialog>(*this); } void UISystem::createDialogBox(float x, float y, float w, float h) @@ -22,14 +23,31 @@ void UISystem::update(entityx::EntityManager&, entityx::EventManager& events, entityx::TimeDelta) { - for (auto& b : m_boxes) { - if (b.vbo == 0) { - auto nre = generateDialogBox(b); - events.emit<NewRenderEvent>(nre); + if (m_clear_boxes) { + m_clear_boxes = false; + + for (const auto& b : m_boxes) { + if (b.vbo != 0) { + events.emit<DelRenderEvent>(b.vbo); + } + } + + m_boxes.clear(); + } else { + for (auto& b : m_boxes) { + if (b.vbo == 0) { + auto nre = generateDialogBox(b); + events.emit<NewRenderEvent>(nre); + } } } } +void UISystem::receive(const HideDialog&) +{ + m_clear_boxes = true; +} + NewRenderEvent UISystem::generateDialogBox(Box& box) { NewRenderEvent nre; |