Skip to content
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: Added IsPressed, IsDown, & IsReleased for virtual buttons to Inputmanager #2258

Merged
merged 3 commits into from
May 26, 2024

Conversation

MechWarrior99
Copy link
Contributor

PR Details

Added IsVirtualButtonPressed/Down/Released methods to the InputManager and surrounding classes.

Description

Added IsVirtualButtonPressed, IsVirtualButtonDown and IsVirtualButtonReleased methods to the InputManager, mirroring the GetVirtualButton method. Added IsPressed .etc methods to VirtualButtonBinding, VirtualButtonConfig and VirtualButtonSet. Again, mirring the GetValue methods.

Renamed GetVirtualButton to GetVirtualButtonValue.

Motivation and Context

Allows pressed, down, and release states to be used with VirtualButtons from the InputManager.

Renamed GetVirtualButton to GetVirtualButtonValue since now that there are more VirtualButton methods it was confusing as to what it was doing (not actually getting a VirtualButton, but reading a input value from one). And matches the termonoligy in the rest of the API were it is refered to by GetValue.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@MechWarrior99
Copy link
Contributor Author

@dotnet-policy-service agree

@Eideren
Copy link
Collaborator

Eideren commented May 22, 2024

Might want to keep a method stub with an obsolete attribute that just calls into the new one, no reason to break users code with this PR.
Looks good otherwise !

@VaclavElias
Copy link
Contributor

Does any manual page need to be updated with these new features?

@MechWarrior99
Copy link
Contributor Author

Yes, at the very least the example should be updated on the Virtual Buttons page to use Input.GetVirtualButtonValue(), though ideally the page would be further updated to show usage of the new methods. Though not sure how needed that really is.

@VaclavElias
Copy link
Contributor

Ohh, I see. Well, once it is merged here, it would be nice to do a PR also to docs and add some content at later stage? Could you do that as well? I can assist with formating but I wouldn't be able to create a content in this case.

@MechWarrior99
Copy link
Contributor Author

Yeah that shouldn't be a issue, I can do that

@Eideren
Copy link
Collaborator

Eideren commented May 25, 2024

Forgot to mention, can you add a summary above each one of those methods, particularly for Pressed and Down since they are easily mixed up. The new methods you added to VirtualButtonConfig and VirtualButtonConfigSet don't have any.

@MechWarrior99
Copy link
Contributor Author

Yeah looks like I forgot some. Added. Probably a conversation for else where, but it is probably a good idea for us to consider changing the name Down to something like Held or Pressing. Even as I was working on this, it took extra mental work to keep Pressed and Down straight haha.

@Eideren Eideren merged commit 5813b9b into stride3d:master May 26, 2024
13 checks passed
@Eideren
Copy link
Collaborator

Eideren commented May 26, 2024

Yeah, it is kind of a pain, feel free to open an issue about this.
Thanks for the PR !

@Eideren Eideren changed the title Added IsPressed, IsDown, & IsReleased for virtual buttons to Inputmanager feat: Added IsPressed, IsDown, & IsReleased for virtual buttons to Inputmanager May 26, 2024
@delustra
Copy link

The feature is great! Thanks for the PR. We'll need to update that https://doc.stride3d.net/latest/en/tutorials/csharpbeginner/virtual-buttons.html as well (and Youtube too I believe)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants