Repository navigation
Conversation
- New Android-specific SDL game controller mapping: X/Y left/right click, A empire map, B problems overlay, D-pad fire/damage/crime/water overlays, RT toggles game speed 100%/70%, Start pauses, Back opens the save dialog prefilled with the current date and time (pressing Back again confirms), LB/RB select and press the previous/next key of 1-0,-,= and LT repeats the selected key - Left stick moves the cursor with a radial threshold, response curve and acceleration ramp for precise small movements - Right stick emulates the mouse cursor pushed against one of the four screen edges, with a start/release threshold and angular hysteresis - Draw the standard game cursor in software on Android while the gamepad drives it; hide it again on touch or real mouse input - Do not warp the mouse on Android: SDL emits a synthetic motion event with wrongly scaled coordinates that dragged the cursor to the top-left - Require trigger axes bound to button-like actions to be pressed past a digital threshold - Add scroll_set_virtual_edge() and window_file_dialog_show_with_name() Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Adds a full gamepad layout for Android, so the game is playable with a controller only.
Button layout (Android)
T)F/D/C/W)P)1 2 3 4 5 6 7 8 9 0 - =1)Overlay and number buttons send real key presses through the hotkey system, so they respect custom hotkey mappings.
Speed changes and key selection show a short on-screen message in the city view.
Cursor
src/input/joystick.c.SDL_WarpMouseInWindowis no longer called on Android. SDL cannot warp the pointer there, and instead emits a synthetic motion event with wrongly scaled coordinates, which pulled the cursor towards the top-left corner every frame.Map scrolling
The right stick does not feed analog values into the arrow-key scrolling. Analog values on both axes produced unwanted diagonal movement, because the scroll code only knows 8 directions and the vertical speed is half the horizontal speed on the isometric map.
Instead, the stick now emulates the cursor pushed against the middle of one of the four screen edges, through a new
scroll_set_virtual_edge(). Scrolling starts at 50% stick travel, stops below 40%, and only changes direction 15° past the sector border.Other changes
DIGITAL_AXIS_THRESHOLD), so a light touch on a trigger no longer fires the action. This applies to all platforms.window_file_dialog_show_with_name()to open the file dialog with a prefilled name.Vita, Switch and the generic (non-game-controller) joystick mappings are unchanged, except for the digital trigger threshold above.
Testing
assembleDebugwith NDK 28.1 / SDL 2.32.8 / SDL_mixer 2.8.1.🤖 Generated with Claude Code