small stuff

This commit is contained in:
That_One_Nerd 2024-05-24 12:37:14 -04:00
parent 3860e16da8
commit cdd4d25fa5
3 changed files with 14 additions and 5 deletions

View File

@ -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
{

View File

@ -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);
}
};

View File

@ -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);