love.mouse.setposition seems to have a random delay

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
artless
Prole
Posts: 6
Joined: Sat Jan 25, 2020 3:36 pm

love.mouse.setposition seems to have a random delay

Post by artless »

A test code:

function love.update(dt)
print(love.mouse.getPosition())
x,y=love.mouse.getPosition()
x=x+10
love.mouse.setPosition(x, y)
print(x,y,love.mouse.getPosition())
end

Some of my output:
73 209
83 209 73 209 (x,y doesn't match getpostion in most cases)
83 209
93 209 83 209
83 209 (the cursor stayed on x=83 for two frames)
93 209 83 209
93 209
103 209 93 209
93 209
103 209 103 209 (x,y match getpostion in rare cases, it seems that getpostion is not simply delayed for one frame)
103 209
113 209 103 209
113 209
123 209 113 209
123 209
133 209 123 209
123 209
133 209 123 209
133 209
143 209 133 209
133 209
143 209 133 209
133 209 (133 lasts four frames)
143 209 133 209
143 209
153 209 143 209


(My system is windows 10.)
Last edited by artless on Wed Aug 12, 2020 6:01 am, edited 1 time in total.
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

Re: love.mouse.setposition seems to have a random delay

Post by pgimeno »

Works fine for me on X11. What's your windowing system? If it's not X11, it's probably the windowing system's fault.

Code: Select all

0	0
10	0	10	0
10	0
20	0	20	0
20	0
30	0	30	0
30	0
40	0	40	0
40	0
50	0	50	0
50	0
60	0	60	0
60	0
70	0	70	0
70	0
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests