Pinch, double tap touch input
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Pinch, double tap touch input
hi, i was wondering if there was any simple library or sample code for achieving a pinch to zoom style of input and a simple double tap action?
Re: Pinch, double tap touch input
I have a huge daunting library posted here that does tons of touch input stuff, you can try your luck with it.
The way you detect gesture is by keeping track of pressed touches and the way they move. Usually simply tracking any two touches as gesture would work, although it it's a buggy way of doing it. Once you have a gesture, you can track it's "rotozoom", i.e. angle and distance simultaneously. If you need so, you can lock onto zoom if you detect greater distance change than angle change, or rotation if angle difference is greater than distance difference. Or if you only need zoom or rotation and so you ignore the other part. Double tap is a bit trickier, you can't do it without keeping track of all recently released touches. When a tap is made, you check it distance-wise and time-wise against all recent other taps and if it's close and quick enough you register it as double tap.
The way you detect gesture is by keeping track of pressed touches and the way they move. Usually simply tracking any two touches as gesture would work, although it it's a buggy way of doing it. Once you have a gesture, you can track it's "rotozoom", i.e. angle and distance simultaneously. If you need so, you can lock onto zoom if you detect greater distance change than angle change, or rotation if angle difference is greater than distance difference. Or if you only need zoom or rotation and so you ignore the other part. Double tap is a bit trickier, you can't do it without keeping track of all recently released touches. When a tap is made, you check it distance-wise and time-wise against all recent other taps and if it's close and quick enough you register it as double tap.
Re: Pinch, double tap touch input
Do you have a link at hand to that library?
Re: Pinch, double tap touch input
https://github.com/raidho36/love-multitouch
While I was looking for it, I found this: https://github.com/Hau-Hau/GestureLib-Love2D
While I was looking for it, I found this: https://github.com/Hau-Hau/GestureLib-Love2D
Re: Pinch, double tap touch input
However, yours works with shapes, but you reported an issue https://github.com/raidho36/love-multitouch/issues/1 you didn't find a solution to this?raidho36 wrote: ↑Sun Jun 25, 2017 1:35 pm https://github.com/raidho36/love-multitouch
While I was looking for it, I found this: https://github.com/Hau-Hau/GestureLib-Love2D
Also, how can I determine the X, Y, dtX and dtY on the Haxe Gesture port? (GestureLib-Love2D) The example is way too thin.
Visual Studio Code Template • RichLÖVE Mobile (AdMob+UnityAds+PlayGamesServices+GameCenter) • Add me on Discord
───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
───█▒▒░░░░░░░░░▒▒█───
────█░░█░░░░░█░░█────
─▄▄──█░░░▀█▀░░░█──▄▄─
█░░█─▀▄░░░░░░░▄▀─█░░█
───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
───█▒▒░░░░░░░░░▒▒█───
────█░░█░░░░░█░░█────
─▄▄──█░░░▀█▀░░░█──▄▄─
█░░█─▀▄░░░░░░░▄▀─█░░█
Re: Pinch, double tap touch input
Well the code works, it's just it doesn't feel very optimal - pretty sure it can be done more efficiently! As for the other library - no idea.
Re: Pinch, double tap touch input
I think the problem is in the interface. I don't think you can make it any better with that interface. Something Löve-style would be more optimal: let the user apply scaling, rotation and shear in the order they prefer, and track these in a matrix.
Re: Pinch, double tap touch input
As I said, I tried doing it that way and it's simply more computationally expensive to do the same job. The issue stays open until there's a computationally cheaper way of doing it. The current setup has 8 multiplications and 10 additions. Myself I found that's impossible to beat, not with using matrices anyway. Best of luck to whoever is smarter than that.
Re: Pinch, double tap touch input
Thank you for your statement, before using it I will consider performance tests.
Visual Studio Code Template • RichLÖVE Mobile (AdMob+UnityAds+PlayGamesServices+GameCenter) • Add me on Discord
───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
───█▒▒░░░░░░░░░▒▒█───
────█░░█░░░░░█░░█────
─▄▄──█░░░▀█▀░░░█──▄▄─
█░░█─▀▄░░░░░░░▄▀─█░░█
───▄▀▀▀▄▄▄▄▄▄▄▀▀▀▄───
───█▒▒░░░░░░░░░▒▒█───
────█░░█░░░░░█░░█────
─▄▄──█░░░▀█▀░░░█──▄▄─
█░░█─▀▄░░░░░░░▄▀─█░░█
Who is online
Users browsing this forum: Bing [Bot] and 10 guests