love.mouse.setposition seems to have a random delay
Posted: Tue Aug 11, 2020 6:04 pm
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.)
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.)