Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | RudyFisher |
My goal is to support universal input for a cross-platform game. Here is the basics of my input event handler for my touchscreen joystick:
func _on_area_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void:
if event is InputEventScreenDrag:
var drag: InputEventScreenDrag = event as InputEventScreenDrag
_pressed = true
elif event is InputEventMouseMotion:
var motion: InputEventMouseMotion = event as InputEventMouseMotion
_pressed = motion.pressure > 0.0
elif event is InputEventScreenTouch:
var touch := event as InputEventScreenTouch
_pressed = touch.pressed
elif event is InputEventMouseButton:
var touch := event as InputEventMouseButton
_pressed = touch.pressed
In project settings > pointing, I have both emulate mouse from touch and emulate touch from mouse enabled. Mouse motion works great, but InputEventScreenDrag doesn’t seem to be recognized by my Area2D once exported onto my Android device (Samsung). Any help appreciated.
Thanks,
Rudy