From a29632daea800df5cb2a297f12d5c5e49129ac8b Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 14 May 2024 14:50:38 -0400 Subject: [PATCH] Fix for DLL_NodeFL --- code/grime_linked_list.odin | 2 +- code/tick_render.odin | 17 +++++++---------- code/ui_floating.odin | 24 ++++++++++++++++-------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/code/grime_linked_list.odin b/code/grime_linked_list.odin index ce4c1a3..d576fcc 100644 --- a/code/grime_linked_list.odin +++ b/code/grime_linked_list.odin @@ -49,7 +49,7 @@ DLL_NodePN :: struct ( $ Type : typeid ) { // }, } -DLL_NodeFL :: struct ( $ Type : typeid ) #raw_union { +DLL_NodeFL :: struct ( $ Type : typeid ) { // using _ : struct { first, last : ^Type, // }, diff --git a/code/tick_render.odin b/code/tick_render.odin index 5de8d66..eff7fa3 100644 --- a/code/tick_render.odin +++ b/code/tick_render.odin @@ -140,8 +140,6 @@ render_mode_2d_workspace :: proc() ws_view_to_render_pos(computed.content.max), ) - // rect_anchors := range2_to_rl_rect( render_anchors ) - // rect_margins := range2_to_rl_rect( render_margins ) rect_bounds := range2_to_rl_rect( render_bounds ) rect_padding := range2_to_rl_rect( render_padding ) rect_content := range2_to_rl_rect( render_content ) @@ -334,12 +332,12 @@ render_screen_ui :: proc() for & current in array_to_slice(ui.render_queue) { - // profile("Box") + profile("Box") + style := current.style computed := & current.computed - computed_size := computed.bounds.p1 - computed.bounds.p0 - + profile_begin("Coordinate space conversion") render_bounds := range2( screen_to_render_pos(computed.bounds.min), screen_to_render_pos(computed.bounds.max), @@ -355,9 +353,9 @@ render_screen_ui :: proc() rect_bounds := range2_to_rl_rect( render_bounds ) rect_padding := range2_to_rl_rect( render_padding ) rect_content := range2_to_rl_rect( render_content ) - // profile_end() + profile_end() - // profile_begin("rl.DrawRectangleRounded( rect_bounds, style.layout.corner_radii[0], 9, style.bg_color )") + profile_begin("raylib drawing") if style.bg_color.a != 0 { draw_rectangle( rect_bounds, & current ) @@ -365,7 +363,6 @@ render_screen_ui :: proc() if current.border_width > 0 { draw_rectangle_lines( rect_bounds, & current, style.border_color, current.border_width ) } - // profile_end() line_thickness : f32 = 1 @@ -376,13 +373,13 @@ render_screen_ui :: proc() else if debug.draw_ui_content_bounds { draw_rectangle_lines( rect_content, & current, Color_Debug_UI_Content_Bounds, line_thickness ) } - // profile_end() point_radius : f32 = 3 // profile_begin("circles") if debug.draw_ui_box_bounds_points { + computed_size := computed.bounds.p1 - computed.bounds.p0 // center := Vec2 { // render_bounds.p0.x + computed_size.x * 0.5, // render_bounds.p0.y - computed_size.y * 0.5, @@ -392,11 +389,11 @@ render_screen_ui :: proc() rl.DrawCircleV( render_bounds.p0, point_radius, Color_Red ) rl.DrawCircleV( render_bounds.p1, point_radius, Color_Blue ) } - // profile_end() if len(current.text.str) > 0 && style.font.key != 0 { draw_text_screenspace( current.text, screen_to_render_pos(computed.text_pos), current.font_size, style.text_color ) } + profile_end() } } //endregion App UI diff --git a/code/ui_floating.odin b/code/ui_floating.odin index 9a88357..8f3d322 100644 --- a/code/ui_floating.odin +++ b/code/ui_floating.odin @@ -113,6 +113,22 @@ ui_floating_build :: proc() continue } lookup.queued = true + + if first == nil { + first = lookup + continue + } + else if last == nil { + first.next = lookup + last = lookup + last.prev = first + continue + } + else { + last.next = lookup + last = lookup + continue + } } else { lookup.captures = to_enqueue.captures @@ -120,14 +136,6 @@ ui_floating_build :: proc() lookup.queued = true continue } - - if first == nil { - first = lookup - last = lookup - continue - } - last.next = lookup - last = lookup } array_clear(build_queue)