From 413ef78504278d37080b9b59a652e4bbd5e2a0fc Mon Sep 17 00:00:00 2001 From: kasull Date: Sun, 1 Mar 2026 20:18:08 -0500 Subject: editor ui rework add responsive editor relayout for window resize rework header with back/save, view mode buttons, and 2d view type selector add clipped, scrollable assets and contextual tool panels simplify tool button wiring and repeated layout logic simplify 2d top-down editor internals and shared grid update hooks --- src/gui/button.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/gui/button.cpp') diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 2b57772..1548e0e 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -5,15 +5,30 @@ void gui_button_draw_fn( void* ptr ) { I32 x = gui_relx( btn ); I32 y = gui_rely( btn ); + I32 mx, my; + gui_cursor_pos( &mx, &my ); + U8 inbounds = mx >= x && mx <= x + btn->w && my >= y && my <= y + btn->h; + U8 active = btn->held && inbounds && gui_mbutton_down( GUI_MBTNLEFT ); + U8 hover = inbounds && !active; + + CLR border = gui_is_fg_window( btn )? ui_clr.border : ui_clr.border_inactive; + if( active ) + border = { 0.f, 1.f, 0.f, 1.f }; + + CLR fill = ui_clr.bg_sec; + CLR txt = ui_clr.txt; + if( hover ) { + fill = ui_clr.border; + txt = CLR::BLACK(); + } - CLR col = gui_is_fg_window( btn )? ui_clr.border : ui_clr.border_inactive; - gui_draw_frect( x, y, btn->w, btn->h, col ); - gui_draw_frect( x+1, y+1, btn->w-2, btn->h-2, ui_clr.bg_sec ); + gui_draw_frect( x, y, btn->w, btn->h, border ); + gui_draw_frect( x+1, y+1, btn->w-2, btn->h-2, fill ); I32 middle = x + btn->w/2; I32 middle_y = y + btn->h/2 - 7; - gui_draw_str( middle, middle_y, ALIGN_C, FNT_JPN12, ui_clr.txt, btn->name ); + gui_draw_str( middle, middle_y, ALIGN_C, FNT_JPN12, txt, btn->name ); } void gui_button_input_fn( void* ptr ) { -- cgit v1.2.3 From 5c4e9c8b140b14ba9671b8efcc47d71c6c4f2217 Mon Sep 17 00:00:00 2001 From: kasull Date: Tue, 3 Mar 2026 12:22:40 -0500 Subject: ui header/menu and add undo/redo for creation actions full-width toolbar/menubar layer move save into file menu and add edit menu actions for undo/redo menubar dropdown interaction modal update header/view-type labels and menu layout behavior creation-history tracking for walls and polygons undo (ctrl+z) and redo (ctrl+r) in 2d editor improve list/button visual states --- src/gui/button.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gui/button.cpp') diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 1548e0e..e66130b 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -12,11 +12,12 @@ void gui_button_draw_fn( void* ptr ) { U8 hover = inbounds && !active; CLR border = gui_is_fg_window( btn )? ui_clr.border : ui_clr.border_inactive; - if( active ) - border = { 0.f, 1.f, 0.f, 1.f }; CLR fill = ui_clr.bg_sec; CLR txt = ui_clr.txt; + if( active ) { + fill = CLR::blend( ui_clr.bg_sec, ui_clr.border, 0.22f ); + } if( hover ) { fill = ui_clr.border; txt = CLR::BLACK(); -- cgit v1.2.3