mirror of
https://github.com/usysrc/LICK.git
synced 2024-11-16 09:34:22 +00:00
reshaped love.run, fixe sleeptime again
This commit is contained in:
parent
59e2536008
commit
2c8ebd86a3
@ -9,7 +9,7 @@ lick.file = "main.lua"
|
|||||||
lick.debug = false
|
lick.debug = false
|
||||||
lick.reset = false
|
lick.reset = false
|
||||||
lick.clearFlag = 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)
|
function handle(err)
|
||||||
return "ERROR: " .. err
|
return "ERROR: " .. err
|
||||||
@ -93,22 +93,10 @@ function love.run()
|
|||||||
|
|
||||||
-- Main loop time.
|
-- Main loop time.
|
||||||
while true do
|
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.
|
-- Process events.
|
||||||
if love.event then
|
if love.event then
|
||||||
for e,a,b,c in love.event.poll() do
|
for e,a,b,c,d in love.event.poll() do
|
||||||
if e == "q" then
|
if e == "q" or e == "quit" then
|
||||||
if not love.quit or not love.quit() then
|
if not love.quit or not love.quit() then
|
||||||
if love.audio then
|
if love.audio then
|
||||||
love.audio.stop()
|
love.audio.stop()
|
||||||
@ -116,10 +104,20 @@ function love.run()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
love.handlers[e](a,b,c)
|
love.handlers[e](a,b,c,d)
|
||||||
end
|
end
|
||||||
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.timer then love.timer.sleep(lick.sleepTime) end
|
||||||
if love.graphics then love.graphics.present() end
|
if love.graphics then love.graphics.present() end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user