新增doGC工具函数,三个模式图标改为代码绘制
This commit is contained in:
25
Zframework/doGC.lua
Normal file
25
Zframework/doGC.lua
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
local gc=love.graphics
|
||||||
|
local cmds={
|
||||||
|
move="translate",
|
||||||
|
zoom="scale",
|
||||||
|
rgb="setColor",
|
||||||
|
wid="setLineWidth",
|
||||||
|
line="line",
|
||||||
|
rect="rectangle",
|
||||||
|
circ="circle",
|
||||||
|
poly="polygon",
|
||||||
|
}
|
||||||
|
return function(L)
|
||||||
|
gc.push()
|
||||||
|
local canvas=gc.newCanvas(L[1],L[2])
|
||||||
|
gc.setCanvas(canvas)
|
||||||
|
gc.origin()
|
||||||
|
gc.setColor(1,1,1)
|
||||||
|
gc.setLineWidth(1)
|
||||||
|
for i=3,#L do
|
||||||
|
gc[cmds[L[i][1]]](unpack(L[i],2))
|
||||||
|
end
|
||||||
|
gc.setCanvas()
|
||||||
|
gc.pop()
|
||||||
|
return canvas
|
||||||
|
end
|
||||||
@@ -26,6 +26,7 @@ VIB= require"Zframework/vibrate"
|
|||||||
SFX= require"Zframework/sfx"
|
SFX= require"Zframework/sfx"
|
||||||
|
|
||||||
LIGHT= require"Zframework/light"
|
LIGHT= require"Zframework/light"
|
||||||
|
DOGC= require"Zframework/doGC"
|
||||||
BG= require"Zframework/background"
|
BG= require"Zframework/background"
|
||||||
WIDGET= require"Zframework/widget"
|
WIDGET= require"Zframework/widget"
|
||||||
TEXT= require"Zframework/text"
|
TEXT= require"Zframework/text"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 486 B |
Binary file not shown.
|
Before Width: | Height: | Size: 283 B |
Binary file not shown.
|
Before Width: | Height: | Size: 252 B |
@@ -68,6 +68,32 @@ local loadingThread=coroutine.create(function()
|
|||||||
|
|
||||||
upFloor()
|
upFloor()
|
||||||
local modeIcons={}
|
local modeIcons={}
|
||||||
|
modeIcons.marathon=DOGC{32,32,
|
||||||
|
{"move",3,1},
|
||||||
|
{"rect","fill",10,4,-2,23},
|
||||||
|
{"poly","fill",10,4,24,10,10,16.5},
|
||||||
|
{"rect","fill",4,24,10,3},
|
||||||
|
}
|
||||||
|
modeIcons.tsd=DOGC{64,64,
|
||||||
|
{"rect","fill",7,7,16,16},
|
||||||
|
{"rect","fill",7,41,16,16},
|
||||||
|
{"rect","fill",41,41,16,16},
|
||||||
|
{"move",.5,.5},
|
||||||
|
{"poly","line",7,24,56,24,56,39,39,39,39,56,24,56,24,39,7,39},
|
||||||
|
}
|
||||||
|
modeIcons.infinite=DOGC{64,64,
|
||||||
|
{"wid",4},
|
||||||
|
{"circ","line",32,32,28},
|
||||||
|
{"line",32,32,32,14},
|
||||||
|
{"line",32,32,41,41},
|
||||||
|
{"move",.5,.5},
|
||||||
|
{"rect","fill",30,7,4,4},
|
||||||
|
{"rect","fill",7,30,4,4},
|
||||||
|
{"rect","fill",52,30,4,4},
|
||||||
|
{"rect","fill",30,52,4,4},
|
||||||
|
}
|
||||||
|
|
||||||
|
upFloor()
|
||||||
for i=1,#MODES do
|
for i=1,#MODES do
|
||||||
local m=MODES[i]--Mode template
|
local m=MODES[i]--Mode template
|
||||||
local M=require("parts/modes/"..m.name)--Mode file
|
local M=require("parts/modes/"..m.name)--Mode file
|
||||||
@@ -202,7 +228,7 @@ function scene.update(dt)
|
|||||||
local p=progress
|
local p=progress
|
||||||
::again::
|
::again::
|
||||||
if loadingThread then
|
if loadingThread then
|
||||||
coroutine.resume(loadingThread)
|
assert(coroutine.resume(loadingThread))
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local rect=gc.rectangle
|
|
||||||
local int=math.floor
|
local int=math.floor
|
||||||
local byte=string.byte
|
local function NSC(x,y)--New & Set Canvas
|
||||||
local function C(x,y)
|
|
||||||
local _=gc.newCanvas(x,y)
|
local _=gc.newCanvas(x,y)
|
||||||
gc.setCanvas(_)
|
gc.setCanvas(_)
|
||||||
return _
|
return _
|
||||||
@@ -14,17 +12,17 @@ gc.setColor(1,1,1)
|
|||||||
local VKI=gc.newImage("media/image/virtualkey.png")
|
local VKI=gc.newImage("media/image/virtualkey.png")
|
||||||
TEXTURE.VKIcon={}
|
TEXTURE.VKIcon={}
|
||||||
for i=1,20 do
|
for i=1,20 do
|
||||||
TEXTURE.VKIcon[i]=C(36,36)
|
TEXTURE.VKIcon[i]=NSC(36,36)
|
||||||
gc.draw(VKI,(i-1)%5*-36,int((i-1)*.2)*-36)
|
gc.draw(VKI,(i-1)%5*-36,int((i-1)*.2)*-36)
|
||||||
end
|
end
|
||||||
|
|
||||||
TEXTURE.miniBlock={}
|
TEXTURE.miniBlock={}
|
||||||
for i=1,29 do
|
for i=1,29 do
|
||||||
local b=BLOCKS[i][0]
|
local b=BLOCKS[i][0]
|
||||||
TEXTURE.miniBlock[i]=C(#b[1],#b)
|
TEXTURE.miniBlock[i]=NSC(#b[1],#b)
|
||||||
for y=1,#b do for x=1,#b[1]do
|
for y=1,#b do for x=1,#b[1]do
|
||||||
if b[y][x]then
|
if b[y][x]then
|
||||||
rect("fill",x-1,#b-y,1,1)
|
gc.rectangle("fill",x-1,#b-y,1,1)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
@@ -32,28 +30,28 @@ end
|
|||||||
TEXTURE.puzzleMark={}
|
TEXTURE.puzzleMark={}
|
||||||
gc.setLineWidth(3)
|
gc.setLineWidth(3)
|
||||||
for i=1,17 do
|
for i=1,17 do
|
||||||
TEXTURE.puzzleMark[i]=C(30,30)
|
TEXTURE.puzzleMark[i]=NSC(30,30)
|
||||||
local _=minoColor[i]
|
local _=minoColor[i]
|
||||||
gc.setColor(_[1],_[2],_[3],.6)
|
gc.setColor(_[1],_[2],_[3],.6)
|
||||||
rect("line",5,5,20,20)
|
gc.rectangle("line",5,5,20,20)
|
||||||
rect("line",10,10,10,10)
|
gc.rectangle("line",10,10,10,10)
|
||||||
end
|
end
|
||||||
for i=18,24 do
|
for i=18,24 do
|
||||||
TEXTURE.puzzleMark[i]=C(30,30)
|
TEXTURE.puzzleMark[i]=NSC(30,30)
|
||||||
gc.setColor(minoColor[i])
|
gc.setColor(minoColor[i])
|
||||||
rect("line",7,7,16,16)
|
gc.rectangle("line",7,7,16,16)
|
||||||
end
|
end
|
||||||
local _=C(30,30)
|
local _=NSC(30,30)
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
gc.line(5,5,25,25)
|
gc.line(5,5,25,25)
|
||||||
gc.line(5,25,25,5)
|
gc.line(5,25,25,5)
|
||||||
TEXTURE.puzzleMark[-1]=C(30,30)
|
TEXTURE.puzzleMark[-1]=NSC(30,30)
|
||||||
gc.setColor(1,1,1,.8)
|
gc.setColor(1,1,1,.8)
|
||||||
gc.draw(_)
|
gc.draw(_)
|
||||||
_:release()
|
_:release()
|
||||||
gc.setCanvas()
|
gc.setCanvas()
|
||||||
|
|
||||||
TEXTURE.mapCross=C(40,40)
|
TEXTURE.mapCross=NSC(40,40)
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
gc.setLineWidth(4)
|
gc.setLineWidth(4)
|
||||||
gc.line(0,20,40,20)
|
gc.line(0,20,40,20)
|
||||||
@@ -62,17 +60,17 @@ gc.line(20,0,20,40)
|
|||||||
TEXTURE.pixelNum={}
|
TEXTURE.pixelNum={}
|
||||||
gc.setLineWidth(4)
|
gc.setLineWidth(4)
|
||||||
for i=0,9 do
|
for i=0,9 do
|
||||||
TEXTURE.pixelNum[i]=C(5,9)
|
TEXTURE.pixelNum[i]=NSC(5,9)
|
||||||
if byte("1011011111",i+1)==49 then rect("fill",1,0,3,1)end--up
|
if("1011011111"):byte(i+1)==49 then gc.rectangle("fill",1,0,3,1)end--up
|
||||||
if byte("0011111011",i+1)==49 then rect("fill",1,4,3,1)end--middle
|
if("0011111011"):byte(i+1)==49 then gc.rectangle("fill",1,4,3,1)end--middle
|
||||||
if byte("1011011011",i+1)==49 then rect("fill",1,8,3,1)end--down
|
if("1011011011"):byte(i+1)==49 then gc.rectangle("fill",1,8,3,1)end--down
|
||||||
if byte("1000111011",i+1)==49 then rect("fill",0,1,1,3)end--up-left
|
if("1000111011"):byte(i+1)==49 then gc.rectangle("fill",0,1,1,3)end--up-left
|
||||||
if byte("1111100111",i+1)==49 then rect("fill",4,1,1,3)end--up-right
|
if("1111100111"):byte(i+1)==49 then gc.rectangle("fill",4,1,1,3)end--up-right
|
||||||
if byte("1010001010",i+1)==49 then rect("fill",0,5,1,3)end--down-left
|
if("1010001010"):byte(i+1)==49 then gc.rectangle("fill",0,5,1,3)end--down-left
|
||||||
if byte("1101111111",i+1)==49 then rect("fill",4,5,1,3)end--down-right
|
if("1101111111"):byte(i+1)==49 then gc.rectangle("fill",4,5,1,3)end--down-right
|
||||||
end
|
end
|
||||||
|
|
||||||
TEXTURE.cursor=C(12,12)
|
TEXTURE.cursor=NSC(12,12)
|
||||||
gc.setColor(1,1,1,.7)
|
gc.setColor(1,1,1,.7)
|
||||||
gc.circle("fill",6,6,6)
|
gc.circle("fill",6,6,6)
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
@@ -86,7 +84,7 @@ local titleTriangles={}
|
|||||||
for i=1,8 do titleTriangles[i]=love.math.triangulate(title[i])end
|
for i=1,8 do titleTriangles[i]=love.math.triangulate(title[i])end
|
||||||
|
|
||||||
--Middle: 580,118
|
--Middle: 580,118
|
||||||
TEXTURE.title=C(1160,236)
|
TEXTURE.title=NSC(1160,236)
|
||||||
for i=1,8 do
|
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)
|
||||||
|
|
||||||
@@ -101,7 +99,7 @@ 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
|
||||||
TEXTURE.title_color=C(1160,236)
|
TEXTURE.title_color=NSC(1160,236)
|
||||||
local titleColor={
|
local titleColor={
|
||||||
COLOR.lGrape,
|
COLOR.lGrape,
|
||||||
COLOR.lCyan,
|
COLOR.lCyan,
|
||||||
@@ -136,14 +134,14 @@ for i=1,8 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
setFont(20)
|
setFont(20)
|
||||||
TEXTURE.ws_dead=C(20,20)
|
TEXTURE.ws_dead=NSC(20,20)
|
||||||
gc.setColor(1,.4,.3)
|
gc.setColor(1,.4,.3)
|
||||||
gc.print("X",3,-4)
|
gc.print("X",3,-4)
|
||||||
TEXTURE.ws_connecting=C(20,20)
|
TEXTURE.ws_connecting=NSC(20,20)
|
||||||
gc.setLineWidth(3)
|
gc.setLineWidth(3)
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
gc.arc("line","open",11.5,10,6.26,1,5.28)
|
gc.arc("line","open",11.5,10,6.26,1,5.28)
|
||||||
TEXTURE.ws_running=C(20,20)
|
TEXTURE.ws_running=NSC(20,20)
|
||||||
gc.setColor(0,.9,0)
|
gc.setColor(0,.9,0)
|
||||||
gc.print("R",3,-4)
|
gc.print("R",3,-4)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user