Repository navigation
gameinput: keyboard pad moves and aims: WASD left stick, mouse right stick, mouse buttons LT/RT - #1130
Conversation
…stick, mouse buttons LT/RT The keyboard pad only pressed buttons, enough for menus. WASD now drives the left stick (opposite keys cancel, diagonals on the round gate), cursor movement the right stick (decaying back to center), and the right/left mouse buttons the left/right triggers. Everything is released on focus loss. A set_cursor_source seam sits beside set_keyboard_source for tests.
|
Tested AI-assisted (Claude Code): it built the branch, ran the tests and wrote this comment.
Not tested: playing with keyboard and mouse in a window (only the test seams were exercised). |
|
Tested 851eb56 on Windows (11 26200, MSVC 19.44) with SDL3 from the pinned
No game files. AI-assisted (Claude Code). |
|
Tested 851eb56 on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1: build pass, gameinput test not run.
AI-assisted. No game files. |
|
Tested 851eb56 on NVIDIA GeForce RTX 5070, driver 621.24 (32.0.16.2124), Windows 11 26H2 (26300), MSVC 14.52 (VS Build Tools 18), Ninja, RelWithDebInfo,
|
|
Tested 851eb56 on Windows 11 Pro 26300, MSVC 14.44 (VS 2022 Build Tools), AMD Radeon RX 9070 / Ryzen 7 5700X, configured with
The failing AI-assisted (Claude Code). |
The keyboard pad (
LEONIDA_KEYBOARD_PAD, #875) only pressed buttons, enough for menus.docs/gameinput.mdleft "move with WASD and aim with the mouse" to a later change. This is that change, so a player without a controller can move and aim as well as navigate.The existing bindings (arrows, Enter, Backspace, X, Y, Q, E, Esc, Tab) are unchanged and none clash. As for keys, input is read only while the game window has focus. Focus loss releases buttons, sticks and triggers and resets the cursor baseline, so moving the mouse in another window doesn't swing the stick when you come back.
update_keyboard_pad()now sets all six axes on each poll, so the separate trigger setup at attach is gone. The new test seamrt::gameinput::set_cursor_source(nullptr restoresGetCursorPos) sits next toset_keyboard_source.Known limits, also in
docs/gameinput.md:shortcut:comment marks it).GetAsyncKeyStatereads the physical mouse buttons, so the swapped-buttons setting is ignored.Tested: Windows 11, VS 2022 Build Tools, configured with
-DLEONIDA_SDL3_FETCH=ON(SDL 3.4.20) sogameinput_testruns.gameinput_test: 165 checks, 0 failures. That includes 20 new checks through the fake key, focus and cursor sources:Full
ctest: 55/55. Not tried in game or with a real mouse.@Cozmaaa, you'd announced this as the follow-up to #875 and I didn't see a later claim. If you have a branch for it, tell me and we'll merge the two.
AI-assisted.