From 7a3381488651df211fe934ff8b58e17fae4b7e13 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 14 Dec 2020 11:27:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 12 +++++++++--- Zframework/log.lua | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 8143ffba..74f1f5fd 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -2,6 +2,7 @@ SCR= require"Zframework/screen" COLOR= require"Zframework/color" SCN= require"Zframework/scene" LOG= require"Zframework/log" + require"Zframework/toolfunc" VIB= require"Zframework/vibrate" @@ -71,11 +72,11 @@ local function updatePowerInfo() gc.draw(IMG.batteryImage,73,3) end setFont(25) - gc.print(os.date("%H:%M",os.time()),3,-5) + gc.print(os.date("%H:%M"),3,-5) gc.pop()gc.setCanvas() end ------------------------------------------------------------- -local lastX,lastY=0,0--Last clickDown pos +local lastX,lastY=0,0--Last click pos function love.mousepressed(x,y,k,touch) if touch then return end mouseShow=true @@ -302,8 +303,13 @@ end function love.sendData(data)end function love.receiveData(id,data)end ]] +local lastGCtime=0 function love.lowmemory() - collectgarbage() + if love.timer.getTime()-lastGCtime>2.6 then + lastGCtime=love.timer.getTime + collectgarbage() + LOG.print("[Auto GC] Low Memory!","warn") + end end function love.resize(w,h) SCR.resize(w,h) diff --git a/Zframework/log.lua b/Zframework/log.lua index f0f53a00..5583139b 100644 --- a/Zframework/log.lua +++ b/Zframework/log.lua @@ -55,7 +55,7 @@ function LOG.print(text,T,C)--text,type/time,color C=C or COLOR.white time=T elseif type(T)=="table"then - C,T=T + C=T elseif not C then C=COLOR.white end