Federico-Ciuffardi / GodotTouchInputManager

Asset that improves touch input support (includes new gestures) in the Godot game engine. It also translates mouse input to touch input.
MIT License
526 stars 35 forks source link

single_taps not recognized after resuming from pause menu #24

Closed tufduckhotmailcom closed 1 year ago

tufduckhotmailcom commented 2 years ago

First, excellent plugin! I'm developing a little Tetris game for mobile and have been using your plugin with great success. Up until now. :)

I have made a pause menu for my game now, and using the in-built Godot pause system by setting get_tree().paused = true. And when I resume the game again with get_tree().paused = false, my single finger taps are no longer recognized. Drags and long presses are. Really weird... On the computer it works, but not on the mobile.

I've been looking through InputManager.gd and testing out a few things, but couldn't get it to work no matter what. I really don't know what's causing this. Could there be some timers that are still running in your script even if the game is paused, and they therefore go out of bounds? I see this condtion:

if raw_gesture.elapsed_time < TAP_TIME_LIMIT and distance <= TAP_DISTANCE_LIMIT:
                    _emit("single_tap", InputEventSingleScreenTap.new(raw_gesture))

I figured that maybe raw_gesture.elapsed_time was being incremented during pause, but I really have no clue what's going on in your code.

Do you think you could maybe take a look in this?

Federico-Ciuffardi commented 2 years ago

I can't reproduce your problem. I tried with the project below where I can change get_tree().paused by pressing the button. I can pause, resume, and then tap with no problem.

GDTIM-pause.tar.gz

Can you provide a minimal project that I can reproduce the bug in? Also, what version of GDTIM and Godot are you using?

tufduckhotmailcom commented 2 years ago

Thanks for answering! I'm using Godot 3.5.1 stable, and the latest GDTIM 2.1.

I'm currently investigating this a bit more. Honestly, it could very well be my own code that is the source of the issue. In case I won't be able to track down the error I will get back to you with a minimal reproduction project.