add gamepad navigation support - #7686
Draft
notimaginative wants to merge 1 commit into
Draft
Conversation
Gamepad navigation is enabled by default but can be disabled with settings. As the retail FreeSpace UI system doesn't lend itself all that well to proper gamepad mechanics, the gamepad inputs instead mimic a mouse and keyboard. Gamepad navigation is only active when at least one gamepad is connected and the mouse cursor is set to visible in the game. One exception is gamepad camera controls (Lab), where no cursor check is performed. A gamepad does NOT need to be set as a current joystick in order to work for navigation. This allows for a gamepad (real or virtual, if recognized by SDL) to be used for UI navigation without affecting the control setup used for gameplay. When gamepad navigation is enabled it also enables Dear ImGui's native gamepad navigation support. While in the Lab or In-game Settings the ImGui gamepad navigation controls will be used instead of the normal FreeSpace-style navigation controls. FreeSpace gamepad navigation controls: Mouse -------- The cursor is controlled via the Left Stick. Left click is simulated via the Action button (A / Cross, by default) Right click is simulated via the X / Square button Keyboard --------- Although they are used inconsistently, with usage and purpose occasionally varying between different menus, the retail UI code generally uses the following keyboard keys for navigation: The ESC key is simulated via the Cancel button (B / Circle, by default) The Arrow keys are simulated via D-Pad The TAB key is simulated via the Right Shoulder button The Shift-TAB combo is simulated via the Left Shoulder button The Page Down key is simulated via the Left Trigger The Page Up key is simulated via the Right Trigger Dear ImGui gamepad navigation controls: The gamepad is supported directly without simulating Mouse/Keyboard inputs. ImGui control layout infographics are available at: https://www.dearimgui.com/controls_sheets/ Camera controls (used in the Lab & chosen to not conflict with ImGui): Right Stick: Orient the displayed object Right Stick + Left Trigger: Rotate the camera Right Stick + Right Trigger: Zoom the camera in or out Right Stick + Both Triggers: Pan the camera on the X/Y plane
Contributor
Author
|
Setting as draft as it will require some sort of update/fix once #7652 gets merged. |
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.
Gamepad navigation is enabled by default but can be disabled with settings. As the retail FreeSpace UI system doesn't lend itself all that well to proper gamepad mechanics, the gamepad inputs instead mimic a mouse and keyboard.
Gamepad navigation is only active when at least one gamepad is connected and the mouse cursor is set to visible in the game. One exception is gamepad camera controls (Lab), where no cursor check is performed.
A gamepad does NOT need to be set as a current joystick in order to work for navigation. This allows for a gamepad (real or virtual, if recognized by SDL) to be used for UI navigation without affecting the control setup used for gameplay.
When gamepad navigation is enabled it also enables Dear ImGui's native gamepad navigation support. While in the Lab or In-game Settings the ImGui gamepad navigation controls will be used instead of the normal FreeSpace-style navigation controls.
FreeSpace gamepad navigation controls:
Mouse
The cursor is controlled via the Left Stick.
Left click is simulated via the Action button (A / Cross, by default) Right click is simulated via the X / Square button
Keyboard
Although they are used inconsistently, with usage and purpose occasionally varying between different menus, the retail UI code generally uses the following keyboard keys for navigation:
The ESC key is simulated via the Cancel button (B / Circle, by default) The Arrow keys are simulated via D-Pad
The TAB key is simulated via the Right Shoulder button The Shift-TAB combo is simulated via the Left Shoulder button The Page Down key is simulated via the Left Trigger The Page Up key is simulated via the Right Trigger
Dear ImGui gamepad navigation controls:
The gamepad is supported directly without simulating Mouse/Keyboard inputs. ImGui control layout infographics are available at: https://www.dearimgui.com/controls_sheets/
Camera controls (used in the Lab & chosen to not conflict with ImGui):
Right Stick: Orient the displayed object
Right Stick + Left Trigger: Rotate the camera
Right Stick + Right Trigger: Zoom the camera in or out
Right Stick + Both Triggers: Pan the camera on the X/Y plane