From f0e66e9dc564486af74d97030e7a2471aa48cf20 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 21 Dec 2021 00:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=86=E6=9E=B6=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=9C=80=E5=A4=A7=E5=B8=A7=E7=8E=87=E7=9A=84=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index fc606eb9..f756044e 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -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.