Possilbe to have love.mousemoved every update?

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.
Post Reply
User avatar
fakedeltatime
Prole
Posts: 3
Joined: Sun Oct 28, 2018 2:45 pm

Possilbe to have love.mousemoved every update?

Post by fakedeltatime »

I'm using the love.mousemoved function to get the Delta movement of the mouse to create some accelerated movement of an object, but the problem I have with it is that it doesn't update when there is no movement. I can fix this by setting the Delta values to 0 at the end of the update loop, but this makes debugging using these values difficult, as the only reading I get is 0. Is there a way to have love.mousemoved update even when there is no movement, or should I just create my own system for it?
User avatar
pgimeno
Party member
Posts: 3686
Joined: Sun Oct 18, 2015 2:58 pm

Re: Possilbe to have love.mousemoved every update?

Post by pgimeno »

Hi fakedeltatime, welcome to the forums.

No, the whole point of callbacks is to notify you of a change. I'm not aware of any method to cause the event to trigger when there's no change.

I'm not sure how you get the values while debugging, but how about setting them to zero at the end of love.draw instead?

Alternatively, you could patch love.event.pump and reset them there.

If neither of these is acceptable, yes, you'll have to work out your own system by using two variables for the old values and reading love.mouse.getPosition() to calculate the deltas inside love.update().
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Possilbe to have love.mousemoved every update?

Post by grump »

Use love.update and query the mouse position with love.mouse.getX() and love.mouse.getY()
User avatar
zorg
Party member
Posts: 3470
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Possilbe to have love.mousemoved every update?

Post by zorg »

grump wrote: Sun Oct 28, 2018 7:40 pm Use love.update and query the mouse position with love.mouse.getX() and love.mouse.getY()
Or love.mouse.getPosition() as pgimeno said above, which returns both coordinates.
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: Google [Bot] and 2 guests