Implement built-in gyroscope support for SDL2 platforms#2540
Merged
a1batross merged 1 commit intoFWGS:masterfrom Apr 15, 2026
Merged
Implement built-in gyroscope support for SDL2 platforms#2540a1batross merged 1 commit intoFWGS:masterfrom
a1batross merged 1 commit intoFWGS:masterfrom
Conversation
a1batross
reviewed
Apr 15, 2026
a1batross
reviewed
Apr 15, 2026
a1batross
reviewed
Apr 15, 2026
Member
a1batross
left a comment
There was a problem hiding this comment.
Seems mostly based on already existing gyro code but SDL2 handles system and joystick gyros separately, so maybe it's fine for now.
874805c to
9053e61
Compare
…SDL2 Sensor API (Android/iOS)
9053e61 to
e9a68c4
Compare
Member
Author
|
Renamed the cl_gyro cvar to gyro_enable, and updated other cvars starting with cl_gyro_ to gyro_, following the naming convention of touch_ and joy_ cvars |
Member
Author
|
I think everything is ready to be merged now. |
aomarov-c2
approved these changes
Apr 15, 2026
a1batross
approved these changes
Apr 15, 2026
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.
Introduce native support for mobile gyroscope sensors using the SDL2 Sensor API, enabling player view and aiming control with the built-in gyroscope on Android, iOS, and other SDL2-compatible platforms.
The implementation is split into platform-agnostic logic in
engine/client/in_gyro.cand a platform-specific sensor layer inengine/platform/sdl2/sensor_sdl2.c.Axis mapping is pre-configured for landscape orientation, typical for mobile gaming.
New CVars
gyro_enable: Master toggle for the built-in gyroscope.
gyro_available (Read-only): Hardware status indicator.
gyro_pitch, gyro_yaw, gyro_roll: Individual axis sensitivity.
gyro_pitch_deadzone, gyro_yaw_deadzone, gyro_roll_deadzone: Configurable thresholds to eliminate sensor jitter and noise.