Godot: Implement InputEventGesture (incl. Pan and Magnify) for all platforms

Created on 21 Nov 2017  路  18Comments  路  Source: godotengine/godot

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Current master (5a23136).

Issue description:
InputEventGesture was added to core in #12573, together with InputEventPanGesture and InputEventMagnifyGesture, but they're only implemented for macOS so far.

They should also be implemented for all platforms where they are relevant. I guess they would make sense on all platforms since gestures can be done on touchscreens as well as touchpads, so the list would be:

  • [ ] Android (#25474)
  • [ ] iOS
  • [ ] Javascript
  • [ ] Linux X11 and (if possible) *BSDs
  • [x] macOS (#12573)
  • [ ] UWP
  • [ ] Windows

See #12573 for the base API and its implementation on macOS.

If more types of gestures are wanted, they should likely be discussed in their own issue, let's keep this one focused on pan and magnify.

enhancement core porting

Most helpful comment

Poor BSD, it doesn't even get its own checkbox.

Poor Linux, it has to share its checkbox.. All X11 platforms share the same code, so they can share the same checkbox.

All 18 comments

Poor BSD, it doesn't even get its own checkbox.

Poor BSD, it doesn't even get its own checkbox.

Poor Linux, it has to share its checkbox.. All X11 platforms share the same code, so they can share the same checkbox.

25474 Merged, check Android box?

@nathanwfranke Done.

25474 Merged, check Android box?

And reverted.

Hi, I made a gdscript (Github, Asset Library) that kind of solves this issue. I wanted to know if it's possible to integrate this gdscript to the engine.

Hi, I made a gdscript (Github, Asset Library) that kind of solves this issue. I wanted to know if it's possible to integrate this gdscript to the engine.

You can't integrate GDScript into the engine per se, you would have to translate the code to be the same format and workflow. However, since you were able to make the library you should be able to learn the engine without much issues.

I made some progress on translating my code to the engine (https://github.com/Federico-Ciuffardi/godot/commit/296fbc8225349ffab8ae74a6d3c3a6b2f2713a8d), but I'm having issues to convert my library's InputEventPinch to the InputEventMagnifyGesture as the InputEventMagnifyGesture has less attributes (factor and position) than my InputEventPinch (distance, relative, position, speed).

I don't know if here is the correct place to ask this but how would be the best way to solve this?

@Federico-Ciuffardi For whatever implementations are implemented already for iOS, those should be deleted in my opinion. Feel free to add/remove those fields as you want since Godot 4.0 is already broken for compatibility

Ok!

Another question, what is the pan gesture exactly?

I believe it is general for the drags. So like if I drag 1 finger or 20 fingers to the left that would be a pan to the left. Basically you should be able to hook them all up to a Camera2D and it would be completely functional.

It's ok if I implement the InputEvents from my library :

  • InputEventPinchGesture instead of InputEventMagnifyGesture.
  • InputEventMultiScreenDrag (or maybe InputEventScreenMultiDrag) instead of InputEventPanGesture.
  • And even add a InputEventTwistGesture.
    I think this could be better since it allows me to make a more direct translation. And also I think the names make more sense (not all pinch gestures have to magnify for example).

Instead of MultiScreenDrag do pan. That way if they drag with 2 fingers that would be a pan and it wouldn't be 2x faster

My implementation of MultiScreenDrag does not cause that, so the pan gesture would be the same as combining ScreenDrag when it's just a finger and otherwise MultiScreenDrag (I do that when I use my library).

I implemented:

  • InputEventPinchGesture
  • InputEventMultiScreenDrag
  • InputEventTwistGesture

https://github.com/Federico-Ciuffardi/godot/tree/3.2-GDTIM

I tested this on a project that used the library modified to work without the library (using the new built-in InputEvents):
https://github.com/Federico-Ciuffardi/GestureControlledCamera2D/tree/built-in
And it is working!

I don't know how to proceed to make a pull request I would need some help with that :disappointed:

@Federico-Ciuffardi first, backup everything you have done on the engine a few times. It would be terrible to lose your progress. Next I would recommend following this tutorial to help you get started with git (using a tool called GitKraken)

So I just branch out form the current master branch make the changes there, and do the PR for this branch? I do not need prior approval?

Go ahead, you don't need prior approval

Was this page helpful?
0 / 5 - 0 ratings