Zframework允许外部设置开关电量显示的条件函数

This commit is contained in:
MrZ626
2021-09-14 17:24:37 +08:00
parent 18471a201f
commit b48e65a9d8
2 changed files with 16 additions and 9 deletions

View File

@@ -556,11 +556,13 @@ local ws_runningImg=GC.DO{20,20,
{'setCL',.5,1,0},
{'mText',"R",11,-1},
}
local function drawCursor(_,x,y)
gc_setColor(1,1,1)
gc_setLineWidth(2)
gc_circle(ms.isDown(1)and'fill'or'line',x,y,6)
end
local function showPowerInfo()return true end
function love.run()
local love=love
@@ -646,7 +648,7 @@ function love.run()
MES_draw()
gc_replaceTransform(SCR.origin)
--Draw power info.
if SETTING.powerInfo then
if showPowerInfo()then
gc_setColor(1,1,1)
gc_draw(infoCanvas,safeX,0,0,SCR.k)
end
@@ -727,7 +729,7 @@ function love.run()
--Fresh power info.
if time-lastFreshPow>2.6 then
if SETTING.powerInfo and LOADED then
if showPowerInfo()then
updatePowerInfo()
lastFreshPow=time
end
@@ -754,6 +756,8 @@ end
local Z={}
function Z.setIfPowerInfo(func)showPowerInfo=func end
--Warning: color and line width is uncertain value, set it in the function.
function Z.setCursor(func)drawCursor=func end