Page 1 of 1
Swiping in Android port
Posted: Fri Jan 22, 2016 5:01 pm
by Kasperelo
So, how does swiping work on love-android-sdl2? I've read a bit about love.touchmoved() but can't really seem to understand it. Any help would be greatly appreciated!
Re: Swiping in Android port
Posted: Sat Jan 23, 2016 9:43 pm
by alberto_lara
I remember a library for gestures in LÖVE called Swingers but I'm not really sure if it is still working.
About the new Android API, there's nothing too complicated, the trio is:
love.touchpressed(id, x, y, pressure)
love.touchmoved(id, x, y, pressure)
love.touchreleased(id, x, y, pressure)
and these 3 functions represent the "life cycle" of each touch. You would need to code something if you want gesture support (this if it's not a library for this already). Good luck!
EDIT: Try to avoid Martin's android-sdl port (terrific work but there's official support now).
Re: Swiping in Android port
Posted: Sat Jan 23, 2016 10:53 pm
by Kasperelo
EDIT: Try to avoid Martin's android-sdl port (terrific work but there's official support now).
What do you mean by Martin's port? Isn't that the official Löve one?
Re: Swiping in Android port
Posted: Sat Jan 23, 2016 11:10 pm
by bartbes
Kasperelo wrote:
What do you mean by Martin's port? Isn't that the official Löve one?
Yes it is.
Re: Swiping in Android port
Posted: Sun Jan 24, 2016 1:01 am
by Nixola
Maybe he meant the 0.9.2 version?
Re: Swiping in Android port
Posted: Sun Jan 24, 2016 10:28 am
by Kasperelo
I'm using the 0.10.0 version.
Re: Swiping in Android port
Posted: Tue Jan 26, 2016 9:50 pm
by alberto_lara
Sorry, and yes, I meant to use the official API support in LÔVE 0.10.0, there are some key differences like you may notice, like the coordinates (now we have real pixels and not 0-1 ranges) and the id not being a number.
EDIT: There's a snippet in the wiki which shows you how to use touches in 0.10.0:
https://love2d.org/wiki/love.touch.getPosition
To use them in love.touchpressed/released/moved, it's almost the same as in the old port, just remember the id is not a number anymore.