pico: add helper to make sure overlay is rendered Sometimes we're going to lock out rendering for a while...
diff --git a/32blit-pico/overlay.cpp b/32blit-pico/overlay.cpp index 31a2cf3..aec4133 100644 --- a/32blit-pico/overlay.cpp +++ b/32blit-pico/overlay.cpp
@@ -8,6 +8,7 @@ static std::string message; static uint32_t progress_value = 0, progress_total = 0; +static bool render_flag = false; static void overlay_render(uint32_t time) { // TODO: don't want to do this if we add a menu to avoid the problems the stm32 firmware has... @@ -22,6 +23,8 @@ uint32_t progress_width = float(progress_value) / progress_total * (screen.bounds.w - 10); screen.rectangle(Rect(5, screen.bounds.h - 10, progress_width, 5)); } + + render_flag = false; } void set_render_overlay_enabled(bool enabled) { @@ -42,3 +45,10 @@ progress_value = value; progress_total = total; } + +void overlay_try_render(bool force) { + render_flag = force; + do { + update_display(blit::now()); + } while(render_flag); +}
diff --git a/32blit-pico/overlay.hpp b/32blit-pico/overlay.hpp index f6aab2b..3f22de5 100644 --- a/32blit-pico/overlay.hpp +++ b/32blit-pico/overlay.hpp
@@ -4,3 +4,5 @@ void set_overlay_message(std::string_view text); void set_overlay_progress(uint32_t value, uint32_t total); + +void overlay_try_render(bool force);