[PR #135] [MERGED] Horizon extras: zoom, FPS counter, keystrokes and the Extras page (off by default) #2345

Closed
opened 2026-11-02 15:55:09 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/135
Author: @ludovic111
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @ludovic111

Base: main ← Head: feat/extras-core


📝 Commits (3)

  • c4b0e8e Horizon extras: zoom, FPS counter and keystroke overlay, off by default
  • a08577e Extras: horizon-ctl key and mouse reach the zoom key and keystrokes
  • 365d35f Extras: the zoom key zooms only while playing and never takes keys

📊 Changes

13 files changed (+1240 additions, -7 deletions)

View changed files

➕ crates/horizon-client/src/extras.rs (+668 -0)
➕ crates/horizon-client/src/extras_hud.rs (+193 -0)
📝 crates/horizon-client/src/game.rs (+11 -1)
📝 crates/horizon-client/src/game/control.rs (+16 -2)
➕ crates/horizon-client/src/game/extras.rs (+156 -0)
📝 crates/horizon-client/src/game/fov.rs (+4 -2)
📝 crates/horizon-client/src/lib.rs (+2 -0)
📝 crates/horizon-client/src/options_horizon.rs (+61 -0)
📝 crates/horizon-client/src/options_ui.rs (+5 -1)
📝 crates/horizon-client/src/settings.rs (+11 -0)
📝 crates/horizon-client/src/ui_theme.rs (+6 -1)
📝 docs/README.md (+1 -0)
➕ docs/extras.md (+106 -0)

📄 Description

What

The first part of NEXT-VERSION §6 (optional built-in extras): a Horizon extras framework and three extras, all off by default.

  • Extras page: a new Extras section in Horizon's Options (launcher design language: switches, value buttons, a description under each setting). Settings are saved in horizon-extras.txt beside options.txt (same key:value format as horizon-graphics.txt), so options.txt stays exactly vanilla's. The file is only written once something differs from the defaults.
  • Zoom: hold the zoom key (default Z, which no vanilla 26.3 key mapping uses; C is key.saveToolbarActivator, and a test checks the default stays free) to zoom; the wheel adjusts it while held (1.25x to 10x) instead of moving the hotbar. Smooth (default on) divides the field-of-view modifier target that vanilla's Camera.tickFov eases toward, the same path the spyglass uses, so it eases exactly like the spyglass and keeps vanilla's 0.1 floor. While scoping, the zoom does nothing, so the spyglass view stays vanilla's. Lower sensitivity (default on) divides mouse turning by the zoom. The key is bound on the Extras page (Horizon has no Horizon category in Controls, and adding one would put a non-vanilla mapping into options.txt).
  • FPS counter: a small "N fps" box in a corner (default top left), optionally with the minimum and 1% low of the last 5 seconds. It is separate from the Advanced graphics frame-time overlay.
  • Keystrokes: W A S D (labelled with the bound keys), the space bar, LMB and RMB that light up while held, with clicks per second.
  • Overlays are drawn in the HUD layer and hidden with F1. Overlays in the same corner stack; the top right corner starts below the status effect icons, and the top left one gives way to the F3 debug screen.
  • docs/extras.md: the design note for every extra (defaults, where it lives, option storage, perf budget). The minimap and auto-reconnect follow in stacked PRs.

Why

Ludovic's NEXT-VERSION list, §6. Vanilla stays the default: with every extra off, nothing changes. The FOV target and mouse turning are vanilla's bit for bit (fov_target returns the vanilla value unchanged at zoom 1, and the turning scale is exactly 1).

Shared files (kept small, rebased on the controller PR #120)

game.rs: six one-line hooks (key, wheel, mouse, frame, HUD, mouse look) and a field. game/fov.rs: two lines. settings.rs: the extras field loaded and saved beside controller. options_horizon.rs: the Extras section. options_ui.rs: the zoom key capture (3 lines). ui_theme.rs: a described row with no cost label.

How tested

  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace on the Mac mini.
  • New unit tests: settings round trip, defaults all off, bad lines, default zoom key free of vanilla bindings, zoom factor (scoping, wheel limits, each press restarts at the default), the zoom target easing through Camera.tickFov like the spyglass (and its floor), sensitivity scale, FPS rate / minimum / 1% low and the 5 s window, clicks per second, corner stacking, item cycling.
  • Screenshots on a vscreen (below).

Screenshots (vscreen, llvmpipe; files on ludodesktop in ~/code/horizon-parity/screens/extras/)

  • off-default-hud.png: a fresh home with every extra off. The HUD is vanilla's, and no horizon-extras.txt is written.
  • on-all.png / keys-test.png: FPS counter with min and 1% low, keystrokes (W and space held via horizon-ctl key, LMB held with 1 CPS), all top left. (The minimap at the top right comes from #136.)
  • zoom-off.png → zoom-on.png: the same view, zoom key held (4x, eased like the spyglass).
  • on-f1-hidden.png: F1 hides every extra.
  • extras-page.png: the Extras section of Horizon's Options. extras-page-round.png after a click: the change is saved to horizon-extras.txt at once.

Also in this PR: horizon-ctl key/mouse go through the same zoom and keystroke hooks as the keyboard, so agents can drive the extras. Under --control the zoom no longer lets go when the window lacks focus.

Not done: Classic menu style has no way to reach the Extras page (it lives in Horizon's Options only, as the brief asked). A Classic button can follow if wanted.

Review round 1

  • Zoom key on screens: the zoom key no longer swallowed the key on screens that share the game's key handler. Now it zooms only while playing (no screen, sign or book open), lets go when a screen opens, and always passes the key on to the screen and to the key binds, like a vanilla key mapping. The same goes for horizon-ctl key. Unit tests: the_zoom_key_only_zooms_while_playing and zoom_key_conflicts_name_the_vanilla_mappings.
  • Conflicts: a vanilla mapping bound to the zoom key still acts (a key bound twice triggers both, as vanilla's do), and the Extras page marks the zoom key Also bound and names the mapping.
  • Checked with horizon-ctl on a vscreen, zoom on, key.drop bound to Z (files in ~/code/horizon-parity/screens/extras/):
    • zoom-conflict-held.png: Z zooms and drops a stick (5 → 4).
    • chat-z-held.png: in chat, Z held gives no zoom, "zoom key zz" is typed and sent, and nothing drops.
    • extras-also-bound.png: the "Also bound: Drop Selected Item" marker.
  • Rebased the stack onto main, keeping #145's Controller rows beside the Extras section.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/135 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/extras-core` --- ### 📝 Commits (3) - [`c4b0e8e`](https://github.com/horizon-rust/horizon/commit/c4b0e8efe0e7f1d5cba9ea7a17ca9c8deb886769) Horizon extras: zoom, FPS counter and keystroke overlay, off by default - [`a08577e`](https://github.com/horizon-rust/horizon/commit/a08577e301c8b83b414fed0c120f55dfabde64a6) Extras: horizon-ctl key and mouse reach the zoom key and keystrokes - [`365d35f`](https://github.com/horizon-rust/horizon/commit/365d35f53ad2e7969679d8ba2111581c8fecf764) Extras: the zoom key zooms only while playing and never takes keys ### 📊 Changes **13 files changed** (+1240 additions, -7 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/src/extras.rs` (+668 -0) ➕ `crates/horizon-client/src/extras_hud.rs` (+193 -0) 📝 `crates/horizon-client/src/game.rs` (+11 -1) 📝 `crates/horizon-client/src/game/control.rs` (+16 -2) ➕ `crates/horizon-client/src/game/extras.rs` (+156 -0) 📝 `crates/horizon-client/src/game/fov.rs` (+4 -2) 📝 `crates/horizon-client/src/lib.rs` (+2 -0) 📝 `crates/horizon-client/src/options_horizon.rs` (+61 -0) 📝 `crates/horizon-client/src/options_ui.rs` (+5 -1) 📝 `crates/horizon-client/src/settings.rs` (+11 -0) 📝 `crates/horizon-client/src/ui_theme.rs` (+6 -1) 📝 `docs/README.md` (+1 -0) ➕ `docs/extras.md` (+106 -0) </details> ### 📄 Description ## What The first part of NEXT-VERSION §6 (optional built-in extras): a **Horizon extras** framework and three extras, **all off by default**. - **Extras page**: a new *Extras* section in Horizon's Options (launcher design language: switches, value buttons, a description under each setting). Settings are saved in `horizon-extras.txt` beside `options.txt` (same `key:value` format as `horizon-graphics.txt`), so `options.txt` stays exactly vanilla's. The file is only written once something differs from the defaults. - **Zoom**: hold the zoom key (default **Z**, which no vanilla 26.3 key mapping uses; C is `key.saveToolbarActivator`, and a test checks the default stays free) to zoom; the wheel adjusts it while held (1.25x to 10x) instead of moving the hotbar. *Smooth* (default on) divides the field-of-view modifier target that vanilla's `Camera.tickFov` eases toward, the same path the spyglass uses, so it eases exactly like the spyglass and keeps vanilla's 0.1 floor. While scoping, the zoom does nothing, so the spyglass view stays vanilla's. *Lower sensitivity* (default on) divides mouse turning by the zoom. The key is bound on the Extras page (Horizon has no Horizon category in Controls, and adding one would put a non-vanilla mapping into `options.txt`). - **FPS counter**: a small "N fps" box in a corner (default top left), optionally with the minimum and 1% low of the last 5 seconds. It is separate from the Advanced graphics frame-time overlay. - **Keystrokes**: W A S D (labelled with the bound keys), the space bar, LMB and RMB that light up while held, with clicks per second. - Overlays are drawn in the HUD layer and hidden with F1. Overlays in the same corner stack; the top right corner starts below the status effect icons, and the top left one gives way to the F3 debug screen. - `docs/extras.md`: the design note for every extra (defaults, where it lives, option storage, perf budget). The minimap and auto-reconnect follow in stacked PRs. ## Why Ludovic's NEXT-VERSION list, §6. Vanilla stays the default: with every extra off, nothing changes. The FOV target and mouse turning are vanilla's bit for bit (`fov_target` returns the vanilla value unchanged at zoom 1, and the turning scale is exactly 1). ## Shared files (kept small, rebased on the controller PR #120) `game.rs`: six one-line hooks (key, wheel, mouse, frame, HUD, mouse look) and a field. `game/fov.rs`: two lines. `settings.rs`: the `extras` field loaded and saved beside `controller`. `options_horizon.rs`: the Extras section. `options_ui.rs`: the zoom key capture (3 lines). `ui_theme.rs`: a described row with no cost label. ## How tested - `cargo fmt --check`, `cargo clippy --workspace --all-targets -D warnings` and `cargo test --workspace` on the Mac mini. - New unit tests: settings round trip, defaults all off, bad lines, default zoom key free of vanilla bindings, zoom factor (scoping, wheel limits, each press restarts at the default), the zoom target easing through `Camera.tickFov` like the spyglass (and its floor), sensitivity scale, FPS rate / minimum / 1% low and the 5 s window, clicks per second, corner stacking, item cycling. - Screenshots on a vscreen (below). ## Screenshots (vscreen, llvmpipe; files on ludodesktop in `~/code/horizon-parity/screens/extras/`) - `off-default-hud.png`: a fresh home with every extra off. The HUD is vanilla's, and no `horizon-extras.txt` is written. - `on-all.png` / `keys-test.png`: FPS counter with min and 1% low, keystrokes (W and space held via `horizon-ctl key`, LMB held with 1 CPS), all top left. (The minimap at the top right comes from #136.) - `zoom-off.png` → `zoom-on.png`: the same view, zoom key held (4x, eased like the spyglass). - `on-f1-hidden.png`: F1 hides every extra. - `extras-page.png`: the Extras section of Horizon's Options. `extras-page-round.png` after a click: the change is saved to `horizon-extras.txt` at once. Also in this PR: `horizon-ctl key`/`mouse` go through the same zoom and keystroke hooks as the keyboard, so agents can drive the extras. Under `--control` the zoom no longer lets go when the window lacks focus. Not done: Classic menu style has no way to reach the Extras page (it lives in Horizon's Options only, as the brief asked). A Classic button can follow if wanted. ## Review round 1 - **Zoom key on screens**: the zoom key no longer swallowed the key on screens that share the game's key handler. Now it zooms only while playing (no screen, sign or book open), lets go when a screen opens, and always passes the key on to the screen and to the key binds, like a vanilla key mapping. The same goes for `horizon-ctl key`. Unit tests: `the_zoom_key_only_zooms_while_playing` and `zoom_key_conflicts_name_the_vanilla_mappings`. - **Conflicts**: a vanilla mapping bound to the zoom key still acts (a key bound twice triggers both, as vanilla's do), and the Extras page marks the zoom key **Also bound** and names the mapping. - Checked with `horizon-ctl` on a vscreen, zoom on, `key.drop` bound to Z (files in `~/code/horizon-parity/screens/extras/`): - `zoom-conflict-held.png`: Z zooms and drops a stick (5 → 4). - `chat-z-held.png`: in chat, Z held gives no zoom, "zoom key zz" is typed and sent, and nothing drops. - `extras-also-bound.png`: the "Also bound: Drop Selected Item" marker. - Rebased the stack onto main, keeping #145's Controller rows beside the Extras section. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:55:09 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2345
No description provided.