From 0e9f3422e37d0b2d1344efec5ceb07c2246bfcd7 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 18:02:10 +0100 Subject: GUI: add F2 preview shell with dummy controls First vertical slice for the custom ISurface GUI: - window/sidebar/content shell with Movement, Combat, Visuals, Weapons and System categories; - cards with dummy Active/Bind, collapsible settings, toggles, sliders, buttons, bind capture, scrolling and tooltips; - native OS cursor by releasing SDL relative mode; reasserted while open; - F2 toggles the preview; Insert still opens the old text tree; - while the GUI is open, do_move freezes movement/buttons/impulses/view and skips combat features; ESP and the speed graph keep drawing. Dummy controls do not touch the real config yet. The text menu is removed after feature parity in the next pass. --- src/menu.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src/menu.cpp') diff --git a/src/menu.cpp b/src/menu.cpp index 9dffc9e..56fe6fa 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -625,9 +625,15 @@ int silentaim_fov() { return g_silent_fov; } bool aimbot_fov_circle() { return g_aim_fov_circle; } +void menu_force_close() { + g_menu_open = false; + g_bind_mode = false; + g_insert_latch = false; + g_menu_draw_logged = false; +} + static void menu_handle_input() { poll_keyboard(); - // SDL state can be sampled several times per rendered frame (both ISurface // hooks call outer_draw). Use a physical-key latch instead of the one-poll // edge so one press cannot open and close the menu in the same frame. @@ -838,11 +844,13 @@ void draw_text_col(int x, int y, const char *text, int r, int g, int b) { // (see hkdDrawPrintText hook in hl2h.cpp): we wrap our draws in // PushMakeCurrent/PopMakeCurrent so they are submitted with a clean clip. void outer_draw() { - menu_handle_input(); + gui_handle_input(); + if (!gui_is_open()) + menu_handle_input(); // HL2H_DRAW_TEST=1 draws a probe rect without needing the menu open static bool draw_test = getenv("HL2H_DRAW_TEST") != nullptr; bool esp_on = feature_active(FEAT_ESP); - if (!g_surface || (!g_menu_open && !draw_test && !esp_on)) + if (!g_surface || (!g_menu_open && !gui_is_open() && !draw_test && !esp_on)) return; // Level/menu -> game transitions can invalidate the VGUI font handle. @@ -896,6 +904,11 @@ void outer_draw() { surf_draw_set_color(255, 255, 255, 255); draw_text(28, 36, "HL2H DRAW TEST"); } + if (gui_is_open()) { + gui_draw(); + surf_pop_make_current(panel); + return; + } if (!g_menu_open) { surf_pop_make_current(panel); return; -- cgit v1.2.3