Any experience with love.touchgestured?

A project to port LÖVE to Android handhelds
Locked
User avatar
norubal
Party member
Posts: 137
Joined: Tue Jan 15, 2013 5:55 am

Any experience with love.touchgestured?

Post by norubal »

Any experience with love.touchgestured? I need to detect swipe gesture in my game, so I decided to use love.touchgestured function.
But I couldn't find some good example from wiki, so I decided to find it out myself how this function work.
This is my code:

Code: Select all

function love.load()
	str = ""
end

function love.touchgestured(x, y, theta, distance, touchcount)
	str = x ..":".. y ..":".. theta ..":".. distance ..":".. touchcount
end

function love.draw()
	love.graphics.print(str)
end
I launched it from my android phone, but no result, It seems to love.touchgestured didn't called by love itself, because str was empty string after screen was touched.
If someone have experience with love.touchgestured, please share! thanks.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Any experience with love.touchgestured?

Post by slime »

The event is only triggered when multiple fingers are touching the screen.
User avatar
norubal
Party member
Posts: 137
Joined: Tue Jan 15, 2013 5:55 am

Re: Any experience with love.touchgestured?

Post by norubal »

slime wrote:The event is only triggered when multiple fingers are touching the screen.
Thank you. I have to find something another to implement swipe gesture..
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Any experience with love.touchgestured?

Post by slime »

You could use love.touchpressed / love.touchmoved / love.touchreleased etc. and detect the swipe by tracking the velocity (i.e. amount moved in a certain direction over a period of time) of the touch.
Locked

Who is online

Users browsing this forum: No registered users and 16 guests