Mouse scrolling

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.
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Mouse scrolling

Post 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
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mouse scrolling

Post 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.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Mouse scrolling

Post 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?
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Mouse scrolling

Post 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.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Mouse scrolling

Post by T-Bone »

Hat Cat uses mouse scrolling for zooming in and out.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mouse scrolling

Post by bartbes »

I did mean mousepressed.
User avatar
sanjiv
Citizen
Posts: 88
Joined: Mon Feb 27, 2012 5:11 am

Re: Mouse scrolling

Post 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.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Mouse scrolling

Post by davisdude »

GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Mouse scrolling

Post 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.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Mouse scrolling

Post by s-ol »

Jasoco wrote: always When in doubt check the Wiki.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
Post Reply

Who is online

Users browsing this forum: No registered users and 74 guests