-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add gamepad support to escoria-ui-simplemouse
This commit starts by introducing a new action, `ESC_UI_PRIMARY_ACTION`, that is used to represent a "primary action" from an input device, such as a left-click on a mouse or the press of the primary button on a gamepad. Although this action is not added to `InputMap` by default in `escoria-core`, `_unhandled_input()` in `esc_item.gd` is updated to look for it. The other portion of this commit is an update to `addons/escoria-ui-simplemouse/game.gd` that adds a gamepad mapping to the `InputMap` for both `ESC_UI_PRIMARY_ACTION` as well as another new action `ESC_UI_CHANGE_VERB_ACTION`. These actions are mapped to X and Y on an XBox controller, respectively. Note that `game.gd` is also updated to implement `_process()` such that moving `JOY_AXIS_0` and `JOY_AXIS_1` on "gamepad 0" will move the cursor around on the screen as the mouse would. Overall, this makes the game fairly playable with a gamepad, though admittedly a mouse is still currently required to click the "New game" button on the initial menu because `BaseButton::gui_input()` appears to be hardcoded to check for mouse events exclusively: https://github.com/godotengine/godot/blob/a09814e4f86861948615fcd83139de6ed9a34434/scene/gui/base_button.cpp#L55-L81
- Loading branch information
Showing
3 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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