summaryrefslogtreecommitdiffstats
path: root/docs/adr/0001-custom-isurface-gui.md
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-27 18:02:10 +0100
committersalmonik <salmonik@tuta.io>2026-10-27 18:02:10 +0100
commit0e9f3422e37d0b2d1344efec5ceb07c2246bfcd7 (patch)
treea8aa0b5a4718f0e7d407a31135823523a77744b0 /docs/adr/0001-custom-isurface-gui.md
parentSpeedgraph: lower the graph (diff)
downloadhl2h-0e9f3422e37d0b2d1344efec5ceb07c2246bfcd7.tar.gz
hl2h-0e9f3422e37d0b2d1344efec5ceb07c2246bfcd7.zip
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.
Diffstat (limited to 'docs/adr/0001-custom-isurface-gui.md')
-rw-r--r--docs/adr/0001-custom-isurface-gui.md58
1 files changed, 58 insertions, 0 deletions
diff --git a/docs/adr/0001-custom-isurface-gui.md b/docs/adr/0001-custom-isurface-gui.md
new file mode 100644
index 0000000..9da3c0c
--- /dev/null
+++ b/docs/adr/0001-custom-isurface-gui.md
@@ -0,0 +1,58 @@
1# 0001 — Custom immediate-mode GUI on ISurface
2
3- Status: Accepted
4- Date: 2026-10-27
5
6## Context
7
8The text-only menu is becoming cumbersome as features accumulate. The cheat
9already has a proven overlay draw path through `ISurface` (`PaintTraverseEx`),
10native text with the bundled Liberation Sans font, text metrics, filled/outlined
11rects, lines and textured polygons. The game runs Source on Linux with a
1232-bit process; the cheat is a single `LD_PRELOAD` shared object.
13
14The main alternatives were:
15
161. Dear ImGui with its standard OpenGL renderer, hooked into the game's
17 swap/present path.
182. Dear ImGui rendered through `ISurface`.
193. A custom immediate-mode GUI on `ISurface`.
204. Keep the text menu and add categories/pages.
21
22`ISurface::Vertex_t` only carries position and UV, not per-vertex color, so a
23standard ImGui draw-list renderer would lose per-widget text colors unless
24draws were split or text was rendered through a separate path. An OpenGL ImGui
25backend would require locating and hooking the swap path, saving/restoring GL
26state, uploading the font atlas, and integrating SDL input events — an
27unverified risk in this build. The existing ISurface path already draws in-game
28and in menus without a new graphics context.
29
30## Decision
31
32Build a custom immediate-mode GUI directly on the existing `ISurface` draw
33path.
34
35- Fixed dark theme with automatic scale:
36 `clamp(min(screen_w/1920, screen_h/1080), 0.75, 1.5)`.
37- Base window 960x620, body/title fonts 15/20 px at scale 1.
38- Left sidebar categories (Movement, Combat, Visuals, Weapons, System) and a
39 content pane of feature cards with collapsible settings.
40- Native OS cursor by releasing SDL relative-mouse mode while the GUI is open.
41- While open, freeze usercmd input/view and skip combat features; keep the
42 game simulating and keep ESP/FOV circle/speed graph drawing.
43- Replace the text menu with the GUI. No permanent fallback menu; git history
44 retains the old implementation.
45
46## Consequences
47
48- We own the widget set (scrollbar, sliders, toggles, keybind capture, tooltips)
49 and the layout/clipping code. Text clipping and wheel events need explicit
50 handling because ISurface has no clip-rect API and SDL does not expose wheel
51 state by polling.
52- No new runtime dependency or GL context management.
53- The GUI remains inside the engine's VGUI paint path, so it inherits the
54 existing font registration and in-game overlay behavior.
55- The old text menu is removed once the GUI reaches feature parity. During
56 development the GUI is built alongside the text menu and opened with a
57 temporary F2 key; the replacement is complete only when the old tree is
58 deleted.