Suggestion: Doubleclick callback

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
NoAim91
Prole
Posts: 38
Joined: Mon Feb 20, 2017 10:28 am
Location: Germany

Suggestion: Doubleclick callback

Post by NoAim91 »

Hi there

it would be cool to have a love.mouse.doubleclick funtion, like the other love.mouse.(mousemoved / mousepressed / mousereleased) callback functions.

I have made the funciton myself, but it would be cool to have it build in love directly :D
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Suggestion: Doubleclick callback

Post by Santos »

Hello! :)

In the next version of LÖVE love.mousepressed and love.mousereleased have a click count argument, which I believe is the number of clicks in quick succession based on the system's double-click speed setting.

Code: Select all

function love.mousepressed(x, y, button, isTouch, clickCount)
  if clickCount == 2 then
    print('Double click!')
  end
end
(You can see the current changelog of the next version of LÖVE here, and you can try the nightly build of the next version for Window or Linux.)
MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

Re: Suggestion: Doubleclick callback

Post by MasterLee »

Question when i double click will i get two events or one event?
Either one is bad.
First will fire single click events although only double click was desired
Second slows down none double clicks
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Suggestion: Doubleclick callback

Post by zorg »

I'd also like this feature to be toggle-able, like the key repeat feature; or at least have it behave in a way that i don't need to bend backwards to work around it.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 63 guests