diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-27 18:02:10 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-27 18:02:10 +0100 |
| commit | 0e9f3422e37d0b2d1344efec5ceb07c2246bfcd7 (patch) | |
| tree | a8aa0b5a4718f0e7d407a31135823523a77744b0 /docs/adr | |
| parent | Speedgraph: lower the graph (diff) | |
| download | hl2h-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')
| -rw-r--r-- | docs/adr/0001-custom-isurface-gui.md | 58 |
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 | |||
| 8 | The text-only menu is becoming cumbersome as features accumulate. The cheat | ||
| 9 | already has a proven overlay draw path through `ISurface` (`PaintTraverseEx`), | ||
| 10 | native text with the bundled Liberation Sans font, text metrics, filled/outlined | ||
| 11 | rects, lines and textured polygons. The game runs Source on Linux with a | ||
| 12 | 32-bit process; the cheat is a single `LD_PRELOAD` shared object. | ||
| 13 | |||
| 14 | The main alternatives were: | ||
| 15 | |||
| 16 | 1. Dear ImGui with its standard OpenGL renderer, hooked into the game's | ||
| 17 | swap/present path. | ||
| 18 | 2. Dear ImGui rendered through `ISurface`. | ||
| 19 | 3. A custom immediate-mode GUI on `ISurface`. | ||
| 20 | 4. Keep the text menu and add categories/pages. | ||
| 21 | |||
| 22 | `ISurface::Vertex_t` only carries position and UV, not per-vertex color, so a | ||
| 23 | standard ImGui draw-list renderer would lose per-widget text colors unless | ||
| 24 | draws were split or text was rendered through a separate path. An OpenGL ImGui | ||
| 25 | backend would require locating and hooking the swap path, saving/restoring GL | ||
| 26 | state, uploading the font atlas, and integrating SDL input events — an | ||
| 27 | unverified risk in this build. The existing ISurface path already draws in-game | ||
| 28 | and in menus without a new graphics context. | ||
| 29 | |||
| 30 | ## Decision | ||
| 31 | |||
| 32 | Build a custom immediate-mode GUI directly on the existing `ISurface` draw | ||
| 33 | path. | ||
| 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. | ||
