reshaped love.run, fixe sleeptime again

This commit is contained in:
headchant 2012-05-26 10:10:46 +02:00
parent 59e2536008
commit 2c8ebd86a3

View File

@ -9,7 +9,7 @@ lick.file = "main.lua"
lick.debug = false
lick.reset = false
lick.clearFlag = false
lick.sleepTime = love.graphics.canvas and 0.001 or 1
lick.sleepTime = love.graphics.newCanvas and 0.001 or 1
function handle(err)
return "ERROR: " .. err
@ -93,22 +93,10 @@ function love.run()
-- Main loop time.
while true do
if love.timer then
love.timer.step()
dt = love.timer.getDelta()
end
-- if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
lick.update(dt)
if love.graphics then
if not lick.clearFlag then love.graphics.clear() end
-- if love.draw then love.draw() end
lick.draw()
end
-- Process events.
if love.event then
for e,a,b,c in love.event.poll() do
if e == "q" then
for e,a,b,c,d in love.event.poll() do
if e == "q" or e == "quit" then
if not love.quit or not love.quit() then
if love.audio then
love.audio.stop()
@ -116,10 +104,20 @@ function love.run()
return
end
end
love.handlers[e](a,b,c)
love.handlers[e](a,b,c,d)
end
end
if love.timer then
love.timer.step()
dt = love.timer.getDelta()
end
lick.update(dt)
if love.graphics then
if not lick.clearFlag then love.graphics.clear() end
lick.draw()
end
if love.timer then love.timer.sleep(lick.sleepTime) end
if love.graphics then love.graphics.present() end