Skip to content

Add rebindable key and controller bindings with settings page - #68

Merged
vanlueckn merged 1 commit into
mainfrom
t3code/add-input-rebinding-settings-page
Aug 20, 2026
Merged

Add rebindable key and controller bindings with settings page#68
vanlueckn merged 1 commit into
mainfrom
t3code/add-input-rebinding-settings-page

Conversation

@vanlueckn

Copy link
Copy Markdown
Collaborator

Summary

  • Introduced crates/app/src/bindings.rs: a complete rebinding system for ~60 controls grouped into buttons (press/release) and levers (position-based)
  • Settings page under Settings → Key bindings with per-control rows showing keyboard and gamepad inputs
  • Enter to rebind (captures next key or controller button), Backspace to clear, Esc to cancel
  • Bindings stored in settings file under [controls] section; only non-default rows are persisted
  • Lever controls (throttle, brake valve, direct brake) bind to analog axes/triggers instead of keys; unbound by default to prevent accidental control hold
  • Look (right stick) and walk (left stick) are always-on, never bindable
  • All controllers answer to the same bindings; one key can only work one control
  • Updated menu and UI systems to support controls page navigation
  • Localization: added i18n keys for all ~60 controls and UI labels in both en/main.ftl and de/main.ftl
  • Key help (F5) dynamically rewritten when bindings change
  • Cleaned up audio module (removed unnecessary shots cache)

Testing

  • Verify controls page renders correctly with keyboard + gamepad inputs side-by-side
  • Test rebinding a button control: Enter, press a key, confirm it takes effect
  • Test rebinding a lever control: Enter, move analog stick/pull trigger, confirm axis is bound
  • Test clearing a binding: Enter, press Backspace, confirm input is removed
  • Test canceling a rebind: Enter, press Esc, confirm original binding unchanged
  • Test one-key exclusivity: bind a key to one control, rebind it elsewhere, confirm it's removed from the first
  • Verify settings file [controls] section only contains changed rows
  • Launch with fresh settings and verify default bindings work
  • Test from both pause menu and Settings screen
  • Verify key help (F5) reflects current bindings after changes
  • (Multiplayer) Confirm bindings are local only; CabInputs positions still network correctly

- New bindings layer above Bevy's raw input: 60 actions grouped by function, controllable by key or pad button
- Levers (throttle, brake valve, direct brake) mappable to stick axes or triggers for absolute control
- Right stick for look, left stick for walk: always-on, unbindable
- Settings → Key bindings page: rebind with Enter, clear with Backspace, Esc to cancel
- One binding per key (rebinding elsewhere removes old binding)
- Stored under [controls] binds, only changes persisted so defaults reach new players
- F5 key help updated in real-time when bindings change
- Controller answers to same bindings on every connected pad
- Multiplayer safe: bindings are local, CabInputs carries the state
@vanlueckn
vanlueckn merged commit 4e5ba8d into main Aug 20, 2026
3 checks passed
@vanlueckn
vanlueckn deleted the t3code/add-input-rebinding-settings-page branch August 20, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant