移除电池、旋转中心的图片改用DOGC,一些框架init中用到的可绘制素材移出TEXTURE模块

This commit is contained in:
MrZ626
2021-05-12 09:16:06 +08:00
parent dd767aa088
commit 71a2bfe284
6 changed files with 59 additions and 48 deletions

View File

@@ -64,6 +64,13 @@ joysticks={}
local devMode local devMode
local batteryImg=DOGC{31,20,
{'fRect',1,0,26,2},
{'fRect',1,18,26,2},
{'fRect',0,1,2,18},
{'fRect',26,1,2,18},
{'fRect',29,3,2,14},
}
local infoCanvas=gc.newCanvas(108,27) local infoCanvas=gc.newCanvas(108,27)
local function updatePowerInfo() local function updatePowerInfo()
local state,pow=love.system.getPowerInfo() local state,pow=love.system.getPowerInfo()
@@ -95,7 +102,7 @@ local function updatePowerInfo()
gc_print(pow,78,2) gc_print(pow,78,2)
end end
end end
gc_draw(IMG.batteryImage,73,3) gc_draw(batteryImg,73,3)
end end
setFont(25) setFont(25)
gc_print(os.date("%H:%M"),3,-5) gc_print(os.date("%H:%M"),3,-5)
@@ -444,6 +451,15 @@ function love.errorhandler(msg)
end end
end end
end end
love.draw,love.update=nil--remove default draw/update
local devColor={
COLOR.Z,
COLOR.lM,
COLOR.lG,
COLOR.lB,
}
local WS=WS local WS=WS
local WSnames={'app','user','play','stream','chat'} local WSnames={'app','user','play','stream','chat'}
local WScolor={ local WScolor={
@@ -453,13 +469,30 @@ local WScolor={
{.4,1,.7,.7}, {.4,1,.7,.7},
{.5,.8,1,.7}, {.5,.8,1,.7},
} }
local devColor={ local ws_deadImg=DOGC{20,20,
COLOR.Z, {'setFT',20},
COLOR.lM, {'setCL',1,.3,.3},
COLOR.lG, {'print',"X",3,-4},
COLOR.lB, }
local ws_connectingImg=DOGC{20,20,
{'setLW',3},
{'dArc',11.5,10,6.26,1,5.28},
}
local ws_runningImg=DOGC{20,20,
{'setFT',20},
{'setCL',.5,1,0},
{'print',"R",3,-4},
}
local cursorImg=DOGC{16,16,
{"fCirc",8,8,4},
{"setCL",1,1,1,.7},
{"fCirc",8,8,6},
}
local cursor_holdImg=DOGC{16,16,
{"setLW",2},
{"dCirc",8,8,7},
{"fCirc",8,8,3},
} }
love.draw,love.update=nil--remove default draw/update
function love.run() function love.run()
local love=love local love=love
@@ -549,7 +582,7 @@ function love.run()
_=SCS[R][0] _=SCS[R][0]
gc_draw(TEXTURE.miniBlock[R],mx,my,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5) gc_draw(TEXTURE.miniBlock[R],mx,my,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5)
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc_draw(TEXTURE[ms.isDown(1)and'cursor_hold'or'cursor'],mx,my,nil,nil,nil,8,8) gc_draw(ms.isDown(1)and cursor_holdImg or cursorImg,mx,my,nil,nil,nil,8,8)
end end
SYSFX.draw() SYSFX.draw()
TEXT.draw() TEXT.draw()
@@ -600,13 +633,13 @@ function love.run()
gc_rectangle('fill',0,20*i,-80,-20) gc_rectangle('fill',0,20*i,-80,-20)
if status=='dead'then if status=='dead'then
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc_draw(TEXTURE.ws_dead,-20,20*i-20) gc_draw(ws_deadImg,-20,20*i-20)
elseif status=='connecting'then elseif status=='connecting'then
gc_setColor(1,1,1,.5+.3*sin(time*6.26)) gc_setColor(1,1,1,.5+.3*sin(time*6.26))
gc_draw(TEXTURE.ws_connecting,-20,20*i-20) gc_draw(ws_connectingImg,-20,20*i-20)
elseif status=='running'then elseif status=='running'then
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc_draw(TEXTURE.ws_running,-20,20*i-20) gc_draw(ws_runningImg,-20,20*i-20)
end end
local t1,t2,t3=WS.getTimers(WSnames[i]) local t1,t2,t3=WS.getTimers(WSnames[i])
gc_setColor(1,1,1,t1)gc_rectangle('fill',-60,20*i,-20,-20) gc_setColor(1,1,1,t1)gc_rectangle('fill',-60,20*i,-20,-20)

View File

@@ -102,15 +102,13 @@ if SETTING.fullscreen then love.window.setFullscreen(true)end
--Initialize image libs --Initialize image libs
IMG.init{ IMG.init{
batteryImage="mess/power.png",
lock="mess/lock.png", lock="mess/lock.png",
dialCircle="mess/dialCircle.png", dialCircle="mess/dialCircle.png",
dialNeedle="mess/dialNeedle.png", dialNeedle="mess/dialNeedle.png",
lifeIcon="mess/life.png", lifeIcon="mess/life.png",
badgeIcon="mess/badge.png", badgeIcon="mess/badge.png",
spinCenter="mess/spinCenter.png",
ctrlSpeedLimit="mess/ctrlSpeedLimit.png", ctrlSpeedLimit="mess/ctrlSpeedLimit.png",
speedLimit="mess/speedLimit.png", speedLimit="mess/speedLimit.png",--Not used, for future C2-mode
pay1="mess/pay1.png", pay1="mess/pay1.png",
pay2="mess/pay2.png", pay2="mess/pay2.png",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

View File

@@ -40,6 +40,16 @@ local multiple=DOGC{15,15,
{'line',2,2,12,12}, {'line',2,2,12,12},
{'line',2,12,12,2}, {'line',2,12,12,2},
} }
local spinCenterImg=DOGC{9,9,
{'setCL',.17,.17,.17},
{'fRect',0,0,9,9},
{'setCL',.57,.57,.57},
{'fRect',1,1,7,7},
{'setCL',.81,.81,.81},
{'fRect',2,2,5,5},
{'setCL',1,1,1},
{'fRect',3,3,3,3},
}
local gridLines do local gridLines do
local L={300,640,{'setLW',2}} local L={300,640,{'setLW',2}}
for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640})end for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640})end
@@ -576,7 +586,7 @@ function draw.norm(P)
drawGhost(P,curColor) drawGhost(P,curColor)
if ENV.center then if ENV.center then
gc_setColor(1,1,1,trans*ENV.center) gc_setColor(1,1,1,trans*ENV.center)
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) gc_draw(spinCenterImg,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
end end
end end
@@ -588,7 +598,7 @@ function draw.norm(P)
drawBlock(P,curColor) drawBlock(P,curColor)
if ENV.center then if ENV.center then
gc_setColor(1,1,1,ENV.center) gc_setColor(1,1,1,ENV.center)
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4) gc_draw(spinCenterImg,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
end end
end end
gc_translate(0,dy) gc_translate(0,dy)
@@ -742,7 +752,7 @@ function draw.norm_remote(P)
drawGhost(P,curColor) drawGhost(P,curColor)
if ENV.center then if ENV.center then
gc_setColor(1,1,1,trans*ENV.center) gc_setColor(1,1,1,trans*ENV.center)
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) gc_draw(spinCenterImg,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
end end
end end
@@ -754,7 +764,7 @@ function draw.norm_remote(P)
drawBlock(P,curColor) drawBlock(P,curColor)
if ENV.center then if ENV.center then
gc_setColor(1,1,1,ENV.center) gc_setColor(1,1,1,ENV.center)
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4) gc_draw(spinCenterImg,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
end end
end end
gc_translate(0,dy) gc_translate(0,dy)

View File

@@ -65,20 +65,6 @@ for i=0,9 do
} }
end end
--Cursor
TEXTURE.cursor=DOGC{16,16,
{"fCirc",8,8,4},
{"setCL",1,1,1,.7},
{"fCirc",8,8,6},
}
--Cursor while hold
TEXTURE.cursor_hold=DOGC{16,16,
{"setLW",2},
{"dCirc",8,8,7},
{"fCirc",8,8,3},
}
--Level icons --Level icons
TEXTURE.lvIcon=setmetatable({},{__index=function(self,lv) TEXTURE.lvIcon=setmetatable({},{__index=function(self,lv)
local img={25,25} local img={25,25}
@@ -165,21 +151,5 @@ for i=1,8 do
gc.translate(-12*i,i==1 and -8 or -14) gc.translate(-12*i,i==1 and -8 or -14)
end end
--WS icons
setFont(20)
TEXTURE.ws_dead=DOGC{20,20,
{'setCL',1,.3,.3},
{'print',"X",3,-4},
}
TEXTURE.ws_connecting=DOGC{20,20,
{'setLW',3},
{'dArc',11.5,10,6.26,1,5.28},
}
TEXTURE.ws_running=DOGC{20,20,
{'setCL',.5,1,0},
{'print',"R",3,-4},
}
gc.setCanvas() gc.setCanvas()
return TEXTURE return TEXTURE