From 8ba97262a0219d7defd928d7bfb5f4214f235fc8 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 18:36:31 +0100 Subject: GUI: fix footer clipping; remove the old text menu - Right-align the footer hint and size the config label from the remaining width, so "INS close" is no longer truncated. - Delete the text-tree menu now that the GUI has feature parity: remove the tree/input/render code, the F1 toggle and menu_force_close. - Keep only held-key polling for feature binds; poll it every frame from outer_draw. - Update CONTEXT/ADR: the GUI is the only menu. --- src/gui.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/gui.cpp') diff --git a/src/gui.cpp b/src/gui.cpp index 7baf383..132068e 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -1,8 +1,7 @@ // gui.cpp — custom immediate-mode GUI // // Categories, feature cards and controls are wired to the real settings in -// menu.cpp. The old text tree is still reachable on F1 until the GUI has been -// verified as a full replacement. +// menu.cpp. This is the only menu; Insert toggles it. #include "hl2h.h" @@ -653,7 +652,6 @@ static void open_gui() { g_scroll = 0.0f; if (g_cat < 0 || g_cat >= CAT_COUNT) g_cat = 0; - menu_force_close(); logf("gui: opened"); } @@ -707,8 +705,6 @@ static void handle_capture(const unsigned char *keys) { continue; if (k == 73) // Insert is reserved for opening/closing the GUI continue; - if (k == 58) // F1 opens the old text tree during the verification pass - continue; if (card.feat) card.feat->bind = k; g_capture_card = -1; @@ -1271,12 +1267,19 @@ void gui_draw() { Rect foot{win.x, win.y + win.h - S(30.0f), win.w, S(30.0f)}; fill(foot, Col{24, 27, 33, 255}); line(foot.x, foot.y, foot.x + foot.w, foot.y, C_BORDER); - text_in(foot, foot.x + S(12.0f), foot.y + S(6.0f), - "config: ~/.config/hl2hake/config", g_font_body, g_body_h, - foot.w - S(220.0f), C_DIM); - text_in(foot, foot.x + foot.w - S(200.0f), foot.y + S(6.0f), - g_capture_card >= 0 ? "press a key / Esc" : "INS close | F1 old menu", - g_font_body, g_body_h, S(190.0f), C_DIM); + const char *hint = + g_capture_card >= 0 ? "press a key / Esc" : "INS close"; + int hint_w = text_w(hint, g_body_h); + int hint_x = foot.x + foot.w - hint_w - S(12.0f); + int left_x = foot.x + S(12.0f); + if (hint_x < left_x) + hint_x = left_x; + int left_max = hint_x - left_x - S(12.0f); + if (left_max > 0) + text_in(foot, left_x, foot.y + S(6.0f), g_config_label, g_font_body, + g_body_h, left_max, C_DIM); + text_in(foot, hint_x, foot.y + S(6.0f), hint, g_font_body, g_body_h, + hint_w + S(4.0f), C_DIM); draw_tooltip(); } -- cgit v1.2.3