Skip to content

Commit 8bb97fc

Browse files
committed
修复love.run执行前发生错误导致没初始化SCR相关坐标系然后错误界面一片蓝
整理代码
1 parent febcda7 commit 8bb97fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ local KBisDown=kb.isDown
1212

1313
local gc=love.graphics
1414
local gc_replaceTransform,gc_translate,gc_present=gc.replaceTransform,gc.translate,gc.present
15-
local gc_clear,gc_discard=gc.clear,gc.discard
1615
local gc_setColor,gc_circle=gc.setColor,gc.circle
1716
local gc_print,gc_printf=gc.print,gc.printf
1817

@@ -585,6 +584,7 @@ function love.errorhandler(msg)
585584
love.audio.stop()
586585
BGM.stop()
587586
gc.reset()
587+
SCR.resize(gc.getWidth(),gc.getHeight())
588588

589589
local sceneStack=SCN and table.concat(SCN.stack,"/") or "NULL"
590590
if mainLoopStarted and #errData<3 and SCN.scenes['error'] then
@@ -629,7 +629,7 @@ function love.errorhandler(msg)
629629
SCR.resize(a,b)
630630
end
631631
end
632-
gc_clear(.3,.5,.9)
632+
GC.clear(.3,.5,.9)
633633
GC.push('transform')
634634
GC.replaceTransform(SCR.origin)
635635
local k=math.min(SCR.h/720,1)
@@ -826,7 +826,7 @@ function love.run()
826826
gc_present()
827827

828828
-- SPEED UPUP! (probably not that obvious)
829-
if discardCanvas then gc_discard() end
829+
if discardCanvas then GC.discard() end
830830
end
831831
end
832832

0 commit comments

Comments
 (0)