框架添加设置最大帧率的入口

This commit is contained in:
MrZ626
2021-12-21 00:16:29 +08:00
parent 0932335f0b
commit f0e66e9dc5

View File

@@ -88,6 +88,7 @@ local showPowerInfo=true
local showClickFX=true
local discardCanvas=false
local frameMul=100
local sleepInterval=1/60
local onQuit=NULL
local batteryImg=GC.DO{31,20,
@@ -821,10 +822,7 @@ function love.run()
end
end
--Keep 60fps
_=timer()-lastFrame
if _<.0162 then WAIT(.0162-_)end
while timer()-lastFrame<1/60 do end
WAIT(sleepInterval)
end
end
@@ -844,6 +842,7 @@ end
function Z.setPowerInfo(bool)showPowerInfo=bool end
function Z.setCleanCanvas(bool)discardCanvas=bool end
function Z.setFrameMul(n)frameMul=n end
function Z.setMaxFPS(fps)sleepInterval=1/fps end
function Z.setClickFX(bool)showClickFX=bool end
--[Warning] Color and line width is uncertain value, set it in the function.