diff --git a/include/sharpsoft/windowing.hpp b/include/sharpsoft/windowing.hpp index 28e52ec..e294e95 100644 --- a/include/sharpsoft/windowing.hpp +++ b/include/sharpsoft/windowing.hpp @@ -9,8 +9,9 @@ namespace sharp { enum window_flags : uint32_t { - CONTINUOUS_PAINT = 0x01, - CONTINUOUS_TICK = 0x02, + CONTINUOUS_PAINT = 0x01, + CONTINUOUS_TICK = 0x02, + HEADER_UPDATE = 0x04, }; enum window_internal_flags : uint32_t { diff --git a/src/main.cpp b/src/main.cpp index 4ac815f..dfacbd4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,8 +12,11 @@ protected: static int frame = 0; frame++; - sharp::color back_col(0, frame % 256, 0); - style().background_color = back_col; + style() = + { + sharp::color(frame % 256, 0, 0), + sharp::color(0, 0, frame % 256) + }; } void tick() override { @@ -23,7 +26,9 @@ protected: public: test_window() : window_base("Testing", sharp::int2(10, 10), sharp::int2(150, 100)) { + set_flag(sharp::CONTINUOUS_PAINT, true); set_flag(sharp::CONTINUOUS_TICK, false); + set_flag(sharp::HEADER_UPDATE, true); } }; diff --git a/src/sharpsoft/global_manager.cpp b/src/sharpsoft/global_manager.cpp index 001ab00..14174ac 100644 --- a/src/sharpsoft/global_manager.cpp +++ b/src/sharpsoft/global_manager.cpp @@ -92,7 +92,10 @@ void sharp::internal::render_iter() } // Now render anything that is invalidated. - if (!HAS_INTERNAL_FLAG(win, WINDOW_HEADER_VALIDATED)) + // If the header is set to sync with the content validation, render it + // regardless of if it would otherwise. + if (!HAS_INTERNAL_FLAG(win, WINDOW_HEADER_VALIDATED) || + (!HAS_INTERNAL_FLAG(win, WINDOW_CONTENT_VALIDATED) && HAS_WINDOW_FLAG(win, HEADER_UPDATE))) { win->paint_header(); ON_INTERNAL_FLAG(win, WINDOW_HEADER_VALIDATED);