Federico-Ciuffardi/GodotTouchInputManager

Godot 4 Support

dave2 opened this issue · 6 comments

dave2 commented

I'm playing around with the current alpha of Godot 4 (4.0-alpha14), and there's quite a few changes which need to be made for at least importing properly.

I can provide a patch but it would probably need a new major version or branch because the changes are not backwards compatible.

dave2 commented

Added initial changes to this branch on my fork: https://github.com/dave2/GodotTouchInputManager/tree/godot-4.0-support

  • 4.0 doesn't allow signal names and variable names to clash, renamed _raw_gesture to _raw_gesture_data
  • Timer.connect() now expects a Callable() instead of object and method name
  • Event.speed is now Event.velocity, renamed this everywhere including in the Drag struct
  • OS.get_ticks_us() is now Time.get_ticks_us()
  • Mouse button consts have MOUSE_ prefix now

Hello David, thank you for your interest in the project!

I created a new godot4support branch, feel free to make a PR when you're done.

Hey @Federico-Ciuffardi , the godot4support branch seems to be exactly inline with master, and doesn't contain Dave's changes above. But I opened a PR branched off of Dave's changes & targeting the godot4support branch: #28

It just occurred to me that one reason it would be nice if/when we can get it merged directly into the engine instead of these being custom events on the GDScript side is that: events triggered through Input.parse_input_event(val) won't process collision queries. Like if I have an Area2D that's pickable, the custom event doesn't reach there:

$Area2D.input_pickable = true
$Area2D.connect("input_event", 
func (_viewport, event, _shape_idx):
  if event is InputEventSingleScreenTap:
    print(event)
)

I don't know if there's a way to fix that, might just need to be a caveat we document

There is an issue about this (#16), at the moment the solution is to manually check for collisions between shapes and events, maybe we should add a FAQ section in the README and include this there. If you want to try it, feel free to do a PR.

Godot 4 is supported after the merge of PR #28!