Possilbe to have love.mousemoved every update?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- fakedeltatime
- Prole
- Posts: 3
- Joined: Sun Oct 28, 2018 2:45 pm
Possilbe to have love.mousemoved every update?
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?
Re: Possilbe to have love.mousemoved every update?
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().
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().
Re: Possilbe to have love.mousemoved every update?
Use love.update and query the mouse position with love.mouse.getX() and love.mouse.getY()
- 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?
Or love.mouse.getPosition() as pgimeno said above, which returns both coordinates.
Me and my stuff True 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.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests