Page 1 of 1

Suggestion: Doubleclick callback

Posted: Wed Aug 16, 2017 10:41 am
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

Re: Suggestion: Doubleclick callback

Posted: Wed Aug 16, 2017 11:01 am
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.)

Re: Suggestion: Doubleclick callback

Posted: Wed Aug 16, 2017 11:17 am
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

Re: Suggestion: Doubleclick callback

Posted: Wed Aug 16, 2017 11:20 am
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.