Page 1 of 2

Mouse scrolling

Posted: Fri Jun 20, 2014 5:24 pm
by Eamonn
Is it possible to add mouse scrolling in LÖVE? I don't believe I've ever seen it done, so I'm wondering if it's possible and how to do it?

How can I tell if the user is scrolling with the mouse wheel?

Thanks! :D

Re: Mouse scrolling

Posted: Fri Jun 20, 2014 5:35 pm
by bartbes
Eamonn wrote:Is it possible to add mouse scrolling in LÖVE?
Sure, why not?
Eamonn wrote:How can I tell if the user is scrolling with the mouse wheel?
love.keypressed gets called every time your scroll wheel "clicks", with "wu" for up and "wd" for down.

Re: Mouse scrolling

Posted: Fri Jun 20, 2014 5:51 pm
by davisdude
bartbes wrote:love.keypressed gets called every time your scroll wheel "clicks", with "wu" for up and "wd" for down.
Don't you mean love.mousepressed?

Re: Mouse scrolling

Posted: Sat Jun 21, 2014 4:32 am
by Jasoco
Yes. Mousepressed, not Keypressed. It sends an event for every tick of the scroll. On OS X it even has the inertia.

Use the "wu" and "wd" as the buttons being clicked.

Re: Mouse scrolling

Posted: Sat Jun 21, 2014 7:47 am
by T-Bone
Hat Cat uses mouse scrolling for zooming in and out.

Re: Mouse scrolling

Posted: Sat Jun 21, 2014 8:30 am
by bartbes
I did mean mousepressed.

Re: Mouse scrolling

Posted: Fri Jun 03, 2016 1:47 am
by sanjiv
Jasoco wrote:Yes. Mousepressed, not Keypressed. It sends an event for every tick of the scroll. On OS X it even has the inertia.

Use the "wu" and "wd" as the buttons being clicked.
update? I think it works differently now. I set up a test to change the background color in love.mousepressed, and it doesn't trigger when I scroll my mouse wheel.

Re: Mouse scrolling

Posted: Fri Jun 03, 2016 2:54 am
by davisdude

Re: Mouse scrolling

Posted: Fri Jun 03, 2016 4:57 am
by Jasoco
Yeah. 0.10.0 changed it to have its own callback. Also I think buttons are numbers now instead of letters for "l" and "r".

When in doubt, check the Wiki.

Re: Mouse scrolling

Posted: Fri Jun 03, 2016 6:05 pm
by s-ol
Jasoco wrote: always When in doubt check the Wiki.