Swiping in Android port

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Swiping in Android port

Post 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!
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: Swiping in Android port

Post 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).
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: Swiping in Android port

Post 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?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Swiping in Android port

Post by bartbes »

Kasperelo wrote: What do you mean by Martin's port? Isn't that the official Löve one?
Yes it is.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Swiping in Android port

Post by Nixola »

Maybe he meant the 0.9.2 version?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Kasperelo
Party member
Posts: 343
Joined: Fri Apr 13, 2012 1:47 pm
Location: The Milky Way

Re: Swiping in Android port

Post by Kasperelo »

I'm using the 0.10.0 version.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: Swiping in Android port

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 7 guests