Zframework允许外部设置开关电量显示的条件函数
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
17
main.lua
17
main.lua
@@ -60,16 +60,19 @@ do
|
||||
local ms=love.mouse
|
||||
Z.setCursor(function(time,x,y)
|
||||
if not SETTING.sysCursor then
|
||||
local R=int((time+1)/2)%7+1
|
||||
_=minoColor[SETTING.skin[R]]
|
||||
gc_setColor(_[1],_[2],_[3],min(abs(1-time%2),.3))
|
||||
_=DSCP[R][0]
|
||||
gc_draw(TEXTURE.miniBlock[R],x,y,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5)
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(ms.isDown(1)and holdImg or normImg,x,y,nil,nil,nil,8,8)
|
||||
local R=int((time+1)/2)%7+1
|
||||
_=minoColor[SETTING.skin[R]]
|
||||
gc_setColor(_[1],_[2],_[3],min(abs(1-time%2),.3))
|
||||
_=DSCP[R][0]
|
||||
gc_draw(TEXTURE.miniBlock[R],x,y,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5)
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(ms.isDown(1)and holdImg or normImg,x,y,nil,nil,nil,8,8)
|
||||
end
|
||||
end)
|
||||
end
|
||||
Z.setIfPowerInfo(function()
|
||||
return SETTING.powerInfo and LOADED
|
||||
end)
|
||||
|
||||
FONT.init('parts/fonts/puhui.ttf')
|
||||
setFont=FONT.set
|
||||
|
||||
Reference in New Issue
Block a user