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

Implement multitouch in BaseButton to supersede TouchScreenButton #3976

Open
Calinou opened this issue Feb 15, 2022 · 7 comments
Open

Implement multitouch in BaseButton to supersede TouchScreenButton #3976

Calinou opened this issue Feb 15, 2022 · 7 comments

Comments

@Calinou
Copy link
Member

Calinou commented Feb 15, 2022

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Since Godot's early days, Godot has two main button nodes:

  • BaseButton1, which extends from Control. Does not support multitouch, and is therefore not suited to mobile controls.
  • TouchScreenButton, which extends from Node2D. Supports multitouch, but does not support Control's anchors, margins and containers system. This makes them difficult to place in specific corners of the screen unless you make them a child of a Control node.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add multitouch support to BaseButton to supersede TouchScreenButton.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  • Implement multitouch for BaseButton.
    • This should preferably include support for displaying pressed styles on multiple buttons at once.
  • Add a Touchscreen Only boolean property to BaseButton (similar to TouchScreenButton's existing property).
  • Deprecate TouchScreenButton as BaseButton (and its derived nodes) will supersede it for all intents and purposes.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

This is a compatibility-breaking change, and it's about improving usability when developing mobile games.

Footnotes

  1. BaseButton is the parent class for Button, TextureButton, LinkButton, CheckBox, CheckButton, and more.

@roalyr
Copy link

roalyr commented Feb 15, 2022

What are the chances of backporting it to 3.x if / when it is implemented? Or does compatibility break deny it?

@Calinou
Copy link
Member Author

Calinou commented Feb 15, 2022

What are the chances of backporting it to 3.x if / when it is implemented? Or does compatibility break deny it?

This is a compatibility-breaking change, but multitouch support could be added to BaseButton without removing TouchScreenButton in 3.x. However, the chances that this feature is implemented before 3.5 is released is slim.

@roalyr
Copy link

roalyr commented Feb 15, 2022

As long as it can arrive within few years I am fine.

@madmiraal
Copy link

godotengine/godot#49215 and it's original 3.x version godotengine/godot#34383 by @NoFr1ends provide support for multi touch in _gui_input().

Note: These PRs only enable multi-touch support in the GUI. They provide the basis for, but do not implement multi-touch in BaseButton.

@Atem1995
Copy link

godotengine/godot#49215 and it's original 3.x version godotengine/godot#34383 by @NoFr1ends provide support for multi touch in _gui_input().

Note: These PRs only enable multi-touch support in the GUI. They provide the basis for, but do not implement multi-touch in BaseButton.

@madmiraal sir,hava you tested it on varsion 3.4?

@grayhaze
Copy link

While this proposal is a good start, I'd like to see touch supported on all Control nodes. Currently if a project requires multitouch support (e.g. pinch zoom), usage of any Control nodes which at present offer mouse interaction (e.g. SplitContainer) is impossible. This effectively removes most of the UI functionality Godot provides on touch devices unless multitouch is disabled.

@Calinou
Copy link
Member Author

Calinou commented Apr 19, 2022

While this proposal is a good start, I'd like to see touch supported on all Control nodes.

This can be done separately from this proposal, as handling native (non-emulated) touch events in Control nodes not inheriting from BaseButton can be implemented independently.

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

No branches or pull requests

6 participants