Delay while running after around 20 seconds
Posted: Thu Jan 27, 2011 3:04 am
So I started playing around with this doing my own basic sample code and I noticed that pretty much no matter what I my scripts start to experience 2~3 second delay between input and changes after around 20 seconds of runtime.
Here is my basic sample code:
-- Globals, becuase Lua is silly like that
num = 15
time = 0
text = 'wtf'
x = 100
y = 100
--Updates
function love.update()
end
--Checks Input
function love.keypressed(k)
if k == 'left' then
time = love.timer.getTime()
end
if k == 'w' then
y = y - 5
end
if k == 's' then
y = y + 5
end
if k == 'a' then
x = x - 5
end
if k == 'd' then
x = x + 5
end
end
--Draws to scren
function love.draw()
love.graphics.setFont(love.graphics.newFont(18))
love.graphics.print('Hello World!', 400, 300)
love.graphics.print(num, 200,200)
love.graphics.print(time, 400,320)
love.graphics.print(text, x,y)
end
------
Does anyone know what I might be doing to cause this or anyway to prevent/fix this rather annoying bug I seem to be experiencing? Would greatly appreciate any help on the topic. I do not experience any such lag when running any of the demos regardless of run-time so I feel it must be something I'm doing. Thanks again!
Here is my basic sample code:
-- Globals, becuase Lua is silly like that
num = 15
time = 0
text = 'wtf'
x = 100
y = 100
--Updates
function love.update()
end
--Checks Input
function love.keypressed(k)
if k == 'left' then
time = love.timer.getTime()
end
if k == 'w' then
y = y - 5
end
if k == 's' then
y = y + 5
end
if k == 'a' then
x = x - 5
end
if k == 'd' then
x = x + 5
end
end
--Draws to scren
function love.draw()
love.graphics.setFont(love.graphics.newFont(18))
love.graphics.print('Hello World!', 400, 300)
love.graphics.print(num, 200,200)
love.graphics.print(time, 400,320)
love.graphics.print(text, x,y)
end
------
Does anyone know what I might be doing to cause this or anyway to prevent/fix this rather annoying bug I seem to be experiencing? Would greatly appreciate any help on the topic. I do not experience any such lag when running any of the demos regardless of run-time so I feel it must be something I'm doing. Thanks again!