Commit Graph
9 Commits
Author SHA1 Message Date
bolinfest d0d97ba9bf feat: add gamepad support to escoria-ui-simplemouse (#518)
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:

godotengine/godot@a09814e/scene/gui/base_button.cpp#L55-L81
2022-03-14 22:15:01 +01:00
Michael Bolin 5a77bd6fdc feat: introduce escoria-ui-keyboard-9verbs to verify register_custom_input_handler() API
This commit was started by copying `addons/escoria-ui-9verbs` as the
basis for `addons/escoria-ui-keyboard-9verbs`. It was then amended to
wire up keyboard shortcuts for each verb using the new
`register_custom_input_handler()` API.

Note that `addons/escoria-ui-keyboard-9verbs/input_map.gd` introduces
one action per verb and provides a `add_actions_to_input_map()`
function to add the actions to the `InputMap`. The `_process_input()`
function in `game.gd` is responsible for mapping each action to the
appropriate call to `verbs_menu.on_action_selected()`.
2022-03-08 14:06:18 +01:00
Michael Bolin 14cf1327fe feat: register_custom_input_handler() API
This introduces a new API on `ESCInputsManager` that makes it
possible to inject custom logic for processing input events.

An example of how to use this API will be introduced in a
separate commit as part of
https://github.com/godot-escoria/escoria-demo-game/pull/503
via a new plugin, `addons/escoria-ui-keyboard-9verbs/`,
which shows how this can be used to add support for keyboard shortcuts
to select a specific verb.
2022-03-08 14:06:18 +01:00
Michael Bolin 7bf3e9f276 refactor: remove trailing whitespace from all .gd files
Not sure why these files were not included in
https://github.com/godot-escoria/escoria-demo-game/pull/494.

Created this diff by running the following on Linux:

```
find -name \*.gd | xargs sed -i -e "s/[[:space:]]\+$//g"
```
2022-03-07 22:01:59 +01:00
Michael Bolin f21ec15560 fix: early return for mouse_in_shape 2022-03-03 21:50:47 +01:00
bolinfest 0570edc3ff fix: ESCItem that is a trigger should not capture input events (#516)
Fixes https://github.com/godot-escoria/escoria-issues/issues/147
2022-03-01 20:48:59 +01:00
bolinfest eee5d1afab chore: add override.cfg to .gitignore (#510) 2022-02-25 08:07:29 +01:00
bolinfest 282ea24b7d fix: enable transition to ESCRoom even if esc_script is not set (#502) 2022-02-24 16:35:32 +01:00
Michael Bolin 045cf9a05e Remove non-existent escoria.action_to_string() function.
Apparently this was accidentally introduced in
99dc1e0110. This commit
removes it and consolidates one clause into the existing
conditional check.
2022-02-19 09:08:24 -08:00