Add Doom-style mouse/trackpad steering#1130
Open
aversag wants to merge 1 commit into
Open
Conversation
Steer the car with the mouse or trackpad. Press ` (backtick) or the Cmd/Win key in-game to grab the mouse: the cursor is hidden and locked in relative mode, and horizontal motion steers the car. Press the same key again to release the mouse for the menus. Keyboard steering keeps working alongside it. Mouse motion accumulates into a steering charge that decays back to centre every poll, so the wheel recentres when the mouse stops. The charge becomes a held steer-left/right key press by OR-ing the *currently bound* steer key into the keyboard state the game reads, so it follows the player's key mapping (arrows, WASD, ...) instead of assuming a fixed binding. Implemented in the SDL harness (SDL2 and SDL3) plus a small read-only helper (GetBoundScanCode) that resolves the bound steer keys; no existing byte-matched game function is modified. Enabled by default; configurable with --no-mouse-steering / --mouse-steering-sensitivity and the matching [General] MouseSteering / MouseSteeringSensitivity INI keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Lets you steer the car with the mouse or trackpad, Doom-style. Press
`(backtick) or theCmd/Winkey in-game to grab the mouse — the cursor is hidden and locked in relative mode, and horizontal movement steers the car. Press the same key again to release it for the menus. Keyboard steering keeps working at the same time.How
Implemented in the SDL harness (plus one small read-only helper), so no existing byte-matched game function is modified:
GetKeyboardState. It follows the player's key mapping (arrows, WASD, …) instead of assuming a fixed binding. The underlyingkey_stateis never modified, so real key presses are untouched and keyboard steering works alongside it.GetBoundScanCode()helper resolves the bound steer keys fromgKey_mapping; it only reads game state.Config
Enabled by default.
--no-mouse-steering, orMouseSteering = 0indethrace.ini.--mouse-steering-sensitivity=1.5, orMouseSteeringSensitivityin the INI.Notes
`andCmd/Winbecause backtick is a dead key on some layouts (e.g. macOS French), where theCmdkey is a reliable alternative.