From 24679e06ddf2c933593b9f00b53f0fe9df2aa573 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 16 Sep 2023 13:29:42 +0200 Subject: [PATCH] libui: Allow not filling the window with a background color every time --- libui/include/ui/Window.h | 2 +- libui/src/Window.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libui/include/ui/Window.h b/libui/include/ui/Window.h index fd914b0a..3e121a8f 100644 --- a/libui/include/ui/Window.h +++ b/libui/include/ui/Window.h @@ -62,7 +62,7 @@ namespace ui int m_id; Canvas m_canvas; Widget* m_main_widget { nullptr }; - Color m_background { ui::BLACK }; + Option m_background {}; Option m_old_mouse_buttons; }; } diff --git a/libui/src/Window.cpp b/libui/src/Window.cpp index fc12467d..298a4499 100644 --- a/libui/src/Window.cpp +++ b/libui/src/Window.cpp @@ -74,7 +74,7 @@ namespace ui Result Window::draw() { - m_canvas.fill(m_background); + if (m_background.has_value()) m_canvas.fill(*m_background); if (m_main_widget) TRY(m_main_widget->draw(m_canvas)); update(); return {};