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 support #300

Closed
inodentry opened this issue Aug 23, 2020 · 9 comments
Closed

Touch input support #300

inodentry opened this issue Aug 23, 2020 · 9 comments
Labels
A-Input Player input via keyboard, mouse, gamepad, and more C-Feature A new feature, making something new possible

Comments

@inodentry
Copy link
Contributor

inodentry commented Aug 23, 2020

We should add support for multi-touch touchscreen input.

EDIT: this should be independent of the mouse or mouse input. They are not the same.

@karroffel karroffel added C-Feature A new feature, making something new possible A-Input Player input via keyboard, mouse, gamepad, and more labels Aug 23, 2020
@Waridley
Copy link
Contributor

I will say I like that Godot can optionally emulate mouse events from touch events or vice-versa. But as long as those events are implemented well separately, it shouldn't be too hard to make an optional system that translates them.

@inodentry
Copy link
Contributor Author

inodentry commented Aug 24, 2020

Yeah, I agree that there should be an easy way to treat them equally for simple games that just need some "basic pointer input", but that should be a separate kind of input event. I really don't like when this is baked into the underlying input system, rather than implemented on top of it. Independent first-class support for the different input devices should be the primary focus. Touch and mouse each offer unique features and it should be possible to make full use of them.

Games designed for touchscreen in mind (important if we want bevy to become viable for mobile and web games) should be able to take full advantage of multitouch, etc. without having to deal with anything to do with the mouse. And vice versa for desktop games designed for mouse input with multiple mouse buttons, scroll wheel, etc., which might not want to work with a touchscreen.

As for the "basic pointer input", this use case is already be partly covered by the CursorMoved events, which can give you the position of "the cursor" regardless of what input device is used to move it. We just need to also offer a general way to detect clicks/presses at the cursor location, which can similarly be triggered regardless of the input device. An easy way to add this could be just adding another field to CursorMoved to indicate the pressed state. Or there could be a separate event type for "cursor presses" that is triggered when clicking with the mouse / tapping the touchscreen. I am in favour of a new event type personally, because "detecting motion" and "detecting presses" are two different use cases.

@aclysma
Copy link
Contributor

aclysma commented Aug 24, 2020

We could go through all the input events that winit and SDL2 can produce and make a list of the ones that we want and decide how to abstract them. Could do the same for windowing as well.

@TheRawMeatball
Copy link
Member

This is a concern, but there are more important blockers atm.

#86

@Waridley
Copy link
Contributor

"More important", sure, but is it really a blocker?
Phones aren't the only devices that have touch screens.
Heck, even Wacom tablet support would be nice.

@inodentry
Copy link
Contributor Author

Yeah, touch input is not limited to mobile. My laptop and many of my friends' laptops nowadays have touchscreens and it is great when software can support touch input properly. I certainly care about it and want to develop things with touch support.

@endragor
Copy link

Regarding the Godot options for emulation of mouse from touch and vice versa. It's actually an annoying hack that does more harm than good when you want to support devices with touch input. Instead, the base UI controls (buttons) should support both Mouse and Touch events. In such case, there would be no need in translating them. And multi-touch would work seamlessly as the base controls would distinguish between finger indexes.

@CleanCut
Copy link
Member

Relevant blog post on Event Chaining as a Decoupling Method in Entity-Component-System by @Jojolepro

@cart
Copy link
Member

cart commented Oct 20, 2020

resolved by #696

@cart cart closed this as completed Oct 20, 2020
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

No branches or pull requests

8 participants