-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add controller input extensions #3
feat: add controller input extensions #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me 😄
Changed names for clarity and in prep for controller input: - KeyboardControlExtensions -> KeyboardInputExtensions - MouseControlExtensions -> MouseInputExtensions - ActionsControlExtensions -> ActionsInputExtensions BREAKING: Changed class names; see above
ef550f2
to
8c82e6b
Compare
Reworked to provide controller-input event simulation. Action-based controller input simulation (for use with Also squashed most commits to make the git history more readable. |
Added a new class with extension methods for simulating input from game controllers. Extension methods fire input events, analogous to keyboard- and mouse-input extensions. Action-based controller inputs can be simulated with existing action-input extensions.
Renamed: - ActionsControlExtensionsTests -> ActionsInputExtensionsTests to match new naming scheme for input extension classes.
Improved similarity of formatting for XML docs on input-extension classes and methods.
* Provided section on extension methods to describe event-based input simulation * Provided pointer to action-simulation section for simulating controller actions
Updated editorconfig to use LF for all file types unless overridden (e.g., for bat/cmd files).
8c82e6b
to
e01444d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for doing this 🙌
(Edited to more accurately describe the PR after a substantial rework; see comment below.)
This PR adds extension methods to simulate controller button and analog-axis input by firing
InputEventJoypadButton
andInputEventJoypadMotion
. This behavior is analogous to existing behavior for keyboard- and mouse-input simulation.Simulation of controller input by way of mapped actions is left to the existing action-input simulation code.
This PR also:
*ControlExtensions
classes to*InputExtensions
(for improved clarity and to avoidControllerControlExtensions
)..bat
,.cmd
) may override this setting.The new controller-input methods are extensions on
Node
(as are the keyboard-input extensions) and are:void PressJoypadButton
void ReleaseJoypadButton
void TapJoypadButton
async Task HoldJoypadButtonFor
void MoveJoypadAxisTo
void ReleaseJoypadAxis
async Task HoldJoypadAxisFor
The "Joypad" naming convention mirrors the names of the associated Godot events.
BREAKING: Classes containing input extension methods have been renamed, so any code that calls them directly (e.g.,
ActionsControlExtensions.StartAction(myNode, "my_action")
instead of the more idiomaticmyNode.StartAction("my_action")
) will break with this change.