From 499f6dc79b529ee302bd80a47f8ab49a0282ee97 Mon Sep 17 00:00:00 2001 From: Alessandro Mauri Date: Wed, 18 Dec 2024 15:10:17 +0100 Subject: [PATCH] removed force update --- src/main.c3 | 6 ------ src/ugui_core.c3 | 12 +----------- src/ugui_input.c3 | 1 - 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/main.c3 b/src/main.c3 index f1f0d25..c2dd11d 100644 --- a/src/main.c3 +++ b/src/main.c3 @@ -126,7 +126,6 @@ fn int main(String[] args) if (ui.button("button0", ugui::Rect{0,0,30,30}, toggle)!!.mouse_press) { io::printn("press button0"); toggle = !toggle; - ui.force_update()!!; } //ui.layout_next_column()!!; if (ui.button("button1", ugui::Rect{0,0,30,30})!!.mouse_press) { @@ -181,11 +180,6 @@ fn int main(String[] args) {| ui.layout_set_row()!!; ui.text_unbounded("ui avg", string::tformat("ui avg: %s\ndraw avg: %s\nTOT: %s", uts.avg, dts.avg, uts.avg+dts.avg))!!; - - //ui.layout_next_row()!!; - //ui.text_unbounded("draw avg", string::tformat("draw avg: %s", dts.avg))!!; - - //ui.force_update()!!; |}; ui.div_end()!!; diff --git a/src/ugui_core.c3 b/src/ugui_core.c3 index 793885a..edc29b8 100644 --- a/src/ugui_core.c3 +++ b/src/ugui_core.c3 @@ -176,8 +176,6 @@ macro bool Rect.is_null(r) => r.x == 0 && r.y == 0 && r.x == 0 && r.w == 0; // return a pointer to the parent of the current active div fn Elem*! Ctx.get_parent(&ctx) { - // FIXME: if the tree held pointers to the elements then no more - // redundant cache search Id parent_id = ctx.tree.get(ctx.active_div)!; return ctx.cache.search(parent_id); } @@ -249,8 +247,7 @@ fn void! Ctx.frame_begin(&ctx) // The root should have the updated flag only if the size of the window // was changed between frames, this propagates an element size recalculation // down the element tree - c_elem.flags.updated = ctx.input.events.resize | ctx.input.events.force_update; - ctx.input.events.force_update = false; + c_elem.flags.updated = ctx.input.events.resize; // if the window has focus then the root element also has focus, no other // computation needed, child elements need to check the mouse positon and // other stuff @@ -282,11 +279,6 @@ fn void! Ctx.frame_begin(&ctx) // TODO: add a background color taken from a theme or config } -fn void! Ctx.force_update(&ctx) -{ - ctx.input.events.force_update = true; -} - fn void! Ctx.frame_end(&ctx) { Elem* root = ctx.get_elem_by_tree_idx(0)!; @@ -296,9 +288,7 @@ fn void! Ctx.frame_end(&ctx) ctx.tree.nuke(); // 2. clear input fields - bool f = ctx.input.events.force_update; ctx.input.events = (InputEvents)0; - ctx.input.events.force_update = f; // send atlas updates if (ctx.font.should_update) { diff --git a/src/ugui_input.c3 b/src/ugui_input.c3 index 0d55615..92d31a7 100644 --- a/src/ugui_input.c3 +++ b/src/ugui_input.c3 @@ -9,7 +9,6 @@ bitstruct InputEvents : uint { bool change_focus : 1; // window focus changed bool mouse_move : 2; // mouse was moved bool mouse_btn : 3; // mouse button pressed or released - bool force_update : 4; } // Window size was changed