mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
The default love.run now checks for the presence of love.graphics, love.event, and love.timer before calling those modules' functions.
This commit is contained in:
+25
-16
@@ -265,27 +265,36 @@ end
|
||||
function love.run()
|
||||
|
||||
if love.load then love.load() end
|
||||
|
||||
local dt = 0
|
||||
|
||||
-- Main loop time.
|
||||
while true do
|
||||
love.timer.step()
|
||||
if love.update then love.update(love.timer.getDelta()) end
|
||||
love.graphics.clear()
|
||||
if love.draw then love.draw() end
|
||||
|
||||
-- Process events.
|
||||
for e,a,b,c in love.event.poll() do
|
||||
if e == "q" then
|
||||
if love.audio then
|
||||
love.audio.stop()
|
||||
end
|
||||
return
|
||||
end
|
||||
love.handlers[e](a,b,c)
|
||||
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
|
||||
if love.graphics then
|
||||
love.graphics.clear()
|
||||
if love.draw then love.draw() end
|
||||
end
|
||||
|
||||
love.timer.sleep(1)
|
||||
love.graphics.present()
|
||||
-- Process events.
|
||||
if love.event then
|
||||
for e,a,b,c in love.event.poll() do
|
||||
if e == "q" then
|
||||
if love.audio then
|
||||
love.audio.stop()
|
||||
end
|
||||
return
|
||||
end
|
||||
love.handlers[e](a,b,c)
|
||||
end
|
||||
end
|
||||
|
||||
if love.timer then love.timer.sleep(1) end
|
||||
if love.graphics then love.graphics.present() end
|
||||
|
||||
end
|
||||
|
||||
|
||||
+1285
-1271
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user