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

Touch input clear function #10913

Closed
miketwenty1 opened this issue Dec 8, 2023 · 0 comments · Fixed by #10930
Closed

Touch input clear function #10913

miketwenty1 opened this issue Dec 8, 2023 · 0 comments · Fixed by #10930
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible

Comments

@miketwenty1
Copy link

miketwenty1 commented Dec 8, 2023

What problem does this solve or what need does it fill?

Currently there is a "clear" and specifically a "clear_just_pressed" function that is very useful for the mouse press input.
For mobile devices playing the game there doesn't seem a way to replicate this logic cleanly.

What solution would you like?

A function exposed similar to the mouse input, like clear_just_touched

What alternative(s) have you considered?

trying to hack a work around

Additional context

Useful if you have a ui overlay on top of your game and you don't want the touch to interact with things underneath the ui.
Currently I'm able to chain() my systems where the ui system interactions are before anything else and I'm able to clear the input if ui has interaction. This prevents a click to bypass the overlay button and interact with the map underneath. This is a situation where the ui and the game loop need to be in the same state.

@miketwenty1 miketwenty1 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Dec 8, 2023
@ItsDoot ItsDoot added A-Input Player input via keyboard, mouse, gamepad, and more and removed S-Needs-Triage This issue needs to be labelled labels Dec 9, 2023
github-merge-queue bot pushed a commit that referenced this issue Jan 4, 2024
# Objective

- Resolves #10913.
- Extend `Touches` with methods that are implemented on `ButtonInput`.

## Solution

- Add function `clear_just_pressed` that clears the `just_pressed` state
of the touch input.
- Add function `clear_just_released` that clears the `just_released`
state of the touch input.
- Add function `clear_just_canceled` that clears the `just_canceled`
state of the touch input.
- Add function `release` that changes state of the touch input from
`pressed` to `just_released`.
- Add function `release_all` that changes state of every touch input
from `pressed` to `just_released`
- Add function `clear` that clears `just_pressed`, `just_released` and
`just_canceled` data for every input.
- Add function `reset_all` that clears `pressed`, `just_pressed`,
`just_released` and `just_canceled` data for every input.
- Add tests for functions above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants