升级SKIN模块,不再需要在启动时就加载好方块贴图资源
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
irs true 提前旋转
|
||||
ims true 提前移动
|
||||
|
||||
skinSet [设置值] 方块贴图,只能填写内置皮肤的名字
|
||||
skin [设置值] 方块颜色,包含25个整数(1~16)的table
|
||||
face [设置值] 方块朝向,包含25个整数(0~3)的table
|
||||
|
||||
|
||||
55
main.lua
55
main.lua
@@ -126,33 +126,33 @@ IMG.init{
|
||||
},
|
||||
}
|
||||
SKIN.init{
|
||||
'crystal_scf',
|
||||
'matte_mrz',
|
||||
'contrast_mrz',
|
||||
'polkadots_scf',
|
||||
'toy_scf',
|
||||
'smooth_mrz',
|
||||
'simple_scf',
|
||||
'glass_scf',
|
||||
'penta_scf',
|
||||
'bubble_scf',
|
||||
'minoes_scf',
|
||||
'pure_mrz',
|
||||
'bright_scf',
|
||||
'glow_mrz',
|
||||
'plastic_mrz',
|
||||
'paper_mrz',
|
||||
'yinyang_scf',
|
||||
'cartooncup_earety',
|
||||
'jelly_miya',
|
||||
'brick_notypey',
|
||||
'gem_notypey',
|
||||
'classic',
|
||||
'ball_shaw',
|
||||
'retro_notypey',
|
||||
'textbone_mrz',
|
||||
'coloredbone_mrz',
|
||||
'wtf',
|
||||
{name="crystal_scf",path='media/image/skin/crystal_scf.png'},
|
||||
{name="matte_mrz",path='media/image/skin/matte_mrz.png'},
|
||||
{name="contrast_mrz",path='media/image/skin/contrast_mrz.png'},
|
||||
{name="polkadots_scf",path='media/image/skin/polkadots_scf.png'},
|
||||
{name="toy_scf",path='media/image/skin/toy_scf.png'},
|
||||
{name="smooth_mrz",path='media/image/skin/smooth_mrz.png'},
|
||||
{name="simple_scf",path='media/image/skin/simple_scf.png'},
|
||||
{name="glass_scf",path='media/image/skin/glass_scf.png'},
|
||||
{name="penta_scf",path='media/image/skin/penta_scf.png'},
|
||||
{name="bubble_scf",path='media/image/skin/bubble_scf.png'},
|
||||
{name="minoes_scf",path='media/image/skin/minoes_scf.png'},
|
||||
{name="pure_mrz",path='media/image/skin/pure_mrz.png'},
|
||||
{name="bright_scf",path='media/image/skin/bright_scf.png'},
|
||||
{name="glow_mrz",path='media/image/skin/glow_mrz.png'},
|
||||
{name="plastic_mrz",path='media/image/skin/plastic_mrz.png'},
|
||||
{name="paper_mrz",path='media/image/skin/paper_mrz.png'},
|
||||
{name="yinyang_scf",path='media/image/skin/yinyang_scf.png'},
|
||||
{name="cartooncup_earety",path='media/image/skin/cartooncup_earety.png'},
|
||||
{name="jelly_miya",path='media/image/skin/jelly_miya.png'},
|
||||
{name="brick_notypey",path='media/image/skin/brick_notypey.png'},
|
||||
{name="gem_notypey",path='media/image/skin/gem_notypey.png'},
|
||||
{name="classic",path='media/image/skin/classic.png'},
|
||||
{name="ball_shaw",path='media/image/skin/ball_shaw.png'},
|
||||
{name="retro_notypey",path='media/image/skin/retro_notypey.png'},
|
||||
{name="textbone_mrz",path='media/image/skin/textbone_mrz.png'},
|
||||
{name="coloredbone_mrz",path='media/image/skin/coloredbone_mrz.png'},
|
||||
{name="wtf",path='media/image/skin/wtf.png'},
|
||||
}
|
||||
|
||||
--Initialize sound libs
|
||||
@@ -272,6 +272,7 @@ do
|
||||
needSave=true
|
||||
end
|
||||
if not SETTING.VKSkin then SETTING.VKSkin=1 end
|
||||
if type(SETTING.skinSet)=='number'then SETTING.skinSet='crystal_scf'end
|
||||
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then
|
||||
SETTING.frameMul=100
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ function back.update()
|
||||
rotate=6.2832*rnd(),
|
||||
va=.05-rnd()*.1,
|
||||
size=SCR.rad*(2+rnd()*3)/100,
|
||||
texture=SKIN.curText[rnd(16)],
|
||||
texture=SKIN.lib[SETTING.skinSet][rnd(16)],
|
||||
}
|
||||
ins(squares,S)
|
||||
t=rnd(6,12)
|
||||
|
||||
@@ -25,7 +25,7 @@ function back.update()
|
||||
k=k,
|
||||
vy=k*2,
|
||||
block=B,
|
||||
texture=SKIN.curText[SETTING.skin[r]],
|
||||
texture=SKIN.lib[SETTING.skinSet][SETTING.skin[r]],
|
||||
})
|
||||
end
|
||||
for i=#mino,1,-1 do
|
||||
|
||||
@@ -305,7 +305,7 @@ SETTING={--Settings
|
||||
fine=false,
|
||||
simpMode=false,
|
||||
lang=1,
|
||||
skinSet=1,
|
||||
skinSet='crystal_scf',
|
||||
skin={
|
||||
1,7,11,3,14,4,9,
|
||||
1,7,2,6,10,2,13,5,9,15,10,11,3,12,2,16,8,4,
|
||||
|
||||
@@ -417,6 +417,7 @@ return{
|
||||
restart="Retry",
|
||||
},
|
||||
setting_skin={
|
||||
skinSet="Block Skin",
|
||||
title="Layout Settings",
|
||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||
skinR="Reset Color",
|
||||
|
||||
@@ -379,6 +379,7 @@ return{
|
||||
restart="Reiniciar",
|
||||
},
|
||||
setting_skin={
|
||||
-- skinSet="Block Skin",
|
||||
title="Ajustes de Texturas",
|
||||
skinR="Color por def.",
|
||||
faceR="Direc. por def.",
|
||||
|
||||
@@ -378,6 +378,7 @@ return{
|
||||
restart="Réessayer",
|
||||
},
|
||||
setting_skin={
|
||||
-- skinSet="Block Skin",
|
||||
title="Disposition",
|
||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||
skinR="Réinit. Couleur",
|
||||
|
||||
@@ -404,6 +404,7 @@ return{
|
||||
restart="Reiniciar",
|
||||
},
|
||||
setting_skin={
|
||||
-- skinSet="Block Skin",
|
||||
title="Config. Layout",
|
||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||
skinR="Reset Cor",
|
||||
|
||||
@@ -232,6 +232,7 @@ return{
|
||||
restart="_→_",
|
||||
},
|
||||
setting_skin={
|
||||
skinSet="[x]?",
|
||||
title="%{~~}",
|
||||
skinR="R @%&",
|
||||
faceR="R ↑↓←→.",
|
||||
|
||||
@@ -111,6 +111,7 @@ return{
|
||||
reset="重设",
|
||||
},
|
||||
setting_skin={
|
||||
skinSet="皮肤",
|
||||
title="改外观",
|
||||
},
|
||||
setting_touchSwitch={
|
||||
|
||||
@@ -416,6 +416,7 @@ return{
|
||||
restart="重新开始",
|
||||
},
|
||||
setting_skin={
|
||||
skinSet="方块皮肤",
|
||||
title="外观设置",
|
||||
spin1="R",spin2="R",spin3="R",spin4="R",spin5="R",spin6="R",spin7="R",
|
||||
skinR="重置配色",
|
||||
|
||||
@@ -96,8 +96,7 @@ local function applyFieldOffset(P,notNorm)
|
||||
end
|
||||
local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end
|
||||
|
||||
local function drawRow(h,V,L,showInvis)
|
||||
local texture=SKIN.curText
|
||||
local function drawRow(texture,h,V,L,showInvis)
|
||||
local t=TIME()*4
|
||||
for i=1,10 do
|
||||
if L[i]>0 then
|
||||
@@ -116,20 +115,20 @@ local function drawField(P)
|
||||
local V,F=P.visTime,P.field
|
||||
local start=int((P.fieldBeneath+P.fieldUp)/30+1)
|
||||
local showInvis=GAME.replaying
|
||||
|
||||
local texture=P.skinLib
|
||||
if P.falling==-1 then--Blocks only
|
||||
if ENV.upEdge then
|
||||
gc_setShader(shader_lighter)
|
||||
gc_translate(0,-4)
|
||||
--<drawRow>
|
||||
for j=start,min(start+21,#F)do drawRow(j,V[j],F[j])end
|
||||
for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j])end
|
||||
--</drawRow>
|
||||
gc_setShader(shader_fieldSatur)
|
||||
gc_translate(0,4)
|
||||
end
|
||||
|
||||
--<drawRow>
|
||||
for j=start,min(start+21,#F)do drawRow(j,V[j],F[j],showInvis)end
|
||||
for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j],showInvis)end
|
||||
--</drawRow>
|
||||
else--With falling animation
|
||||
local stepY=ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30
|
||||
@@ -145,7 +144,7 @@ local function drawField(P)
|
||||
h=h+1
|
||||
gc_translate(0,-stepY)
|
||||
end
|
||||
drawRow(j,V[j],F[j])
|
||||
drawRow(texture,j,V[j],F[j])
|
||||
end
|
||||
--</drawRow>
|
||||
gc_setShader(shader_fieldSatur)
|
||||
@@ -162,7 +161,7 @@ local function drawField(P)
|
||||
gc_setColor(1,1,1,alpha)
|
||||
gc_rectangle('fill',0,30-30*j,300,stepY)
|
||||
end
|
||||
drawRow(j,V[j],F[j],showInvis)
|
||||
drawRow(texture,j,V[j],F[j],showInvis)
|
||||
end
|
||||
--</drawRow>
|
||||
gc_pop()
|
||||
@@ -191,7 +190,7 @@ local function drawFXs(P)
|
||||
end
|
||||
|
||||
--MoveFX
|
||||
local texture=SKIN.curText
|
||||
local texture=P.skinLib
|
||||
for i=1,#P.moveFX do
|
||||
local S=P.moveFX[i]
|
||||
gc_setColor(1,1,1,.6-S[4]*.6)
|
||||
@@ -211,7 +210,7 @@ end
|
||||
local drawGhost={
|
||||
color=function(P,clr,alpha)
|
||||
gc_setColor(1,1,1,alpha)
|
||||
local texture=SKIN.curText
|
||||
local texture=P.skinLib
|
||||
local CB=P.cur.bk
|
||||
for i=1,#CB do for j=1,#CB[1]do
|
||||
if CB[i][j]then
|
||||
@@ -221,7 +220,7 @@ local drawGhost={
|
||||
end,
|
||||
gray=function(P,_,alpha)
|
||||
gc_setColor(1,1,1,alpha)
|
||||
local texture=SKIN.curText
|
||||
local texture=P.skinLib
|
||||
local CB=P.cur.bk
|
||||
for i=1,#CB do for j=1,#CB[1]do
|
||||
if CB[i][j]then
|
||||
@@ -298,7 +297,7 @@ end
|
||||
local function drawBlock(P,clr)
|
||||
gc_setColor(1,1,1)
|
||||
gc_setShader(shader_blockSatur)
|
||||
local texture=SKIN.curText[clr]
|
||||
local texture=P.skinLib[clr]
|
||||
local CB=P.cur.bk
|
||||
for i=1,#CB do for j=1,#CB[1]do
|
||||
if CB[i][j]then
|
||||
@@ -420,7 +419,7 @@ local function drawHold(P)
|
||||
for n=1,#holdQueue do
|
||||
if n==N then gc_setColor(.6,.4,.4)end
|
||||
local bk,clr=holdQueue[n].bk,holdQueue[n].color
|
||||
local texture=SKIN.curText[clr]
|
||||
local texture=P.skinLib[clr]
|
||||
local k=#bk>2 and 2.2/#bk or 1
|
||||
gc_scale(k)
|
||||
for i=1,#bk do for j=1,#bk[1]do
|
||||
@@ -539,7 +538,7 @@ draw.applyFieldOffset=applyFieldOffset
|
||||
draw.drawGhost=drawGhost
|
||||
function draw.drawNext_norm(P)
|
||||
local ENV=P.gameEnv
|
||||
local texture=SKIN.curText
|
||||
local texture=P.skinLib
|
||||
gc_translate(316,20)
|
||||
local N=ENV.nextCount*72
|
||||
gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
||||
@@ -574,7 +573,7 @@ function draw.drawNext_norm(P)
|
||||
end
|
||||
function draw.drawNext_hidden(P)
|
||||
local ENV=P.gameEnv
|
||||
local texture=SKIN.curText
|
||||
local texture=P.skinLib
|
||||
gc_translate(316,20)
|
||||
local N=ENV.nextCount*72
|
||||
gc_setColor(.5,0,0,.4)gc_rectangle('fill',0,0,124,N+8)
|
||||
@@ -699,7 +698,7 @@ function draw.norm(P)
|
||||
gc_translate(0,-dy)
|
||||
--Draw block & rotation center
|
||||
if ENV.block then
|
||||
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
||||
drawBlockOutline(P,P.skinLib[curColor],trans)
|
||||
drawBlock(P,curColor)
|
||||
if ENV.center then
|
||||
gc_setColor(1,1,1,ENV.center)
|
||||
@@ -833,7 +832,7 @@ function draw.small(P)
|
||||
|
||||
--Field
|
||||
local F=P.field
|
||||
local texture=SKIN.curTextMini
|
||||
local texture=SKIN.libMini[SETTING.skinSet]
|
||||
for j=1,#F do
|
||||
for i=1,10 do if F[j][i]>0 then
|
||||
gc_draw(texture[F[j][i]],6*i-6,120-6*j)
|
||||
@@ -902,7 +901,7 @@ function draw.demo(P)
|
||||
if ENV.block then
|
||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||
gc_translate(0,-dy)
|
||||
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
|
||||
drawBlockOutline(P,P.skinLib[curColor],P.lockDelay/ENV.lock)
|
||||
drawBlock(P,curColor)
|
||||
gc_translate(0,dy)
|
||||
end
|
||||
|
||||
@@ -38,6 +38,7 @@ return{
|
||||
RS='TRS',
|
||||
sequence='bag',
|
||||
seqData={1,2,3,4,5,6,7},
|
||||
skinSet='crystal_scf',
|
||||
face=false,skin=false,
|
||||
mission=false,
|
||||
|
||||
|
||||
@@ -293,6 +293,8 @@ local function applyGameEnv(P)--Finish gameEnv processing
|
||||
P.keyAvailable[v]=false
|
||||
end
|
||||
|
||||
P.skinLib=SKIN.lib[ENV.skinSet]
|
||||
|
||||
P:setInvisible(
|
||||
ENV.visible=='show'and -1 or
|
||||
ENV.visible=='easy'and 300 or
|
||||
|
||||
@@ -91,7 +91,7 @@ function Player:createSplashFX(h)
|
||||
if c>0 then
|
||||
SYSFX.newCell(
|
||||
2.5-self.gameEnv.splashFX*.4,
|
||||
SKIN.curText[c],
|
||||
self.skinLib[c],
|
||||
size,
|
||||
self.fieldX+(30*x-15)*size,y-30*h*size,
|
||||
rnd()*5-2.5,rnd()*-1,
|
||||
|
||||
@@ -149,7 +149,7 @@ function scene.draw()
|
||||
gc.rectangle('line',-2,-2,304,604)
|
||||
local F=FIELD[1]
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local texture=SKIN.curText
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for y=1,20 do for x=1,10 do
|
||||
local B=F[y][x]
|
||||
if B>0 then
|
||||
|
||||
@@ -273,7 +273,7 @@ function scene.draw()
|
||||
gc.setLineWidth(2)
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
local F=FIELD[page]
|
||||
local texture=SKIN.curText
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for y=1,20 do for x=1,10 do
|
||||
local B=F[y][x]
|
||||
if B>0 then
|
||||
|
||||
@@ -21,11 +21,6 @@ local loadingThread=coroutine.wrap(function()
|
||||
logoColor2={COLOR.rainbow_light(r)}
|
||||
end
|
||||
YIELD('loadSFX')SFX.loadAll()
|
||||
YIELD('loadSkin')
|
||||
for i=1,SKIN.getCount()do
|
||||
SKIN.loadOne()
|
||||
if i%math.floor(SKIN.getCount()/9)==0 then YIELD()end
|
||||
end
|
||||
YIELD('loadVoice')VOC.loadAll()
|
||||
YIELD('loadFont')for i=1,17 do getFont(15+5*i)end
|
||||
|
||||
@@ -123,7 +118,6 @@ local loadingThread=coroutine.wrap(function()
|
||||
end
|
||||
|
||||
YIELD('loadOther')
|
||||
SKIN.change(SETTING.skinSet)
|
||||
STAT.run=STAT.run+1
|
||||
|
||||
--Connect to server
|
||||
|
||||
@@ -67,7 +67,7 @@ function scene.draw()
|
||||
gc.line(400,-10,400,90)
|
||||
|
||||
--O mino animation
|
||||
local O=SKIN.curText[SETTING.skin[6]]
|
||||
local O=SKIN.lib[SETTING.skinSet][SETTING.skin[6]]
|
||||
gc.draw(O,40*pos,0,nil,40/30)
|
||||
gc.draw(O,40*pos,40,nil,40/30)
|
||||
gc.draw(O,40*pos+40,0,nil,40/30)
|
||||
|
||||
@@ -13,9 +13,9 @@ function scene.draw()
|
||||
local t=TIME()
|
||||
local b=math.floor(t*2)%16+1
|
||||
gc.setColor(1,1,1)
|
||||
gc.draw(SKIN.curText[b],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
|
||||
gc.draw(SKIN.lib[SETTING.skinSet][b],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
|
||||
gc.setColor(1,1,1,t*2%1)
|
||||
gc.draw(SKIN.curText[b%16+1],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
|
||||
gc.draw(SKIN.lib[SETTING.skinSet][b%16+1],410,540-WIDGET.scrollPos,t%6.2832,2,nil,15,15)
|
||||
end
|
||||
|
||||
scene.widgetScrollHeight=200
|
||||
|
||||
@@ -21,7 +21,7 @@ end
|
||||
function scene.draw()
|
||||
local t=TIME()
|
||||
gc.setColor(1,1,1)
|
||||
local texture=SKIN.curText
|
||||
local texture=SKIN.lib[SETTING.skinSet]
|
||||
for n=1,7 do
|
||||
gc.push('transform')
|
||||
gc.translate(-10+140*n,340)
|
||||
@@ -59,8 +59,7 @@ end
|
||||
scene.widgetList={
|
||||
WIDGET.newText{name="title", x=80,y=50,font=70,align='L'},
|
||||
|
||||
WIDGET.newButton{name="prev", x=700,y=100,w=140,h=100,fText="←",font=50,code=function()SKIN.prevSet()end},
|
||||
WIDGET.newButton{name="next", x=860,y=100,w=140,h=100,fText="→",font=50,code=function()SKIN.nextSet()end},
|
||||
WIDGET.newSelector{name="skinSet",x=780,y=100,w=260,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')},
|
||||
WIDGET.newButton{name="prev1", x=130,y=230,w=90,h=65,fText="↑",code=function()prevSkin(1)end},
|
||||
WIDGET.newButton{name="prev2", x=270,y=230,w=90,h=65,fText="↑",code=function()prevSkin(2)end},
|
||||
WIDGET.newButton{name="prev3", x=410,y=230,w=90,h=65,fText="↑",code=function()prevSkin(3)end},
|
||||
|
||||
@@ -16,7 +16,7 @@ function scene.draw()
|
||||
gc.pop()
|
||||
gc.push('transform')
|
||||
gc.setColor(1,1,1)
|
||||
local L=SKIN.curText
|
||||
local L=SKIN.lib[SETTING.skinSet]
|
||||
local T=L[1]
|
||||
gc.translate(0,1410-WIDGET.scrollPos)
|
||||
gc.setShader(SHADER.blockSatur)
|
||||
|
||||
122
parts/skin.lua
122
parts/skin.lua
@@ -1,82 +1,54 @@
|
||||
local SKIN={
|
||||
getCount=function()return 0 end,
|
||||
loadOne=function()error("Cannot load before init!")end,
|
||||
loadAll=function()error("Cannot load before init!")end,
|
||||
prevSet=NULL,
|
||||
nextSet=NULL,
|
||||
prev=NULL,
|
||||
next=NULL,
|
||||
rotate=NULL,
|
||||
change=NULL,
|
||||
}
|
||||
local SKIN={}
|
||||
function SKIN.init(list)
|
||||
local Skins={}
|
||||
|
||||
local simpList={}
|
||||
for _,v in next,list do
|
||||
table.insert(simpList,v.name)
|
||||
Skins[v.name]=v.path
|
||||
end
|
||||
function SKIN.getList()return simpList end
|
||||
|
||||
local gc=love.graphics
|
||||
local int=math.floor
|
||||
local function C(x,y)
|
||||
local _=gc.newCanvas(x,y)
|
||||
gc.setCanvas(_)
|
||||
return _
|
||||
end
|
||||
local count=#list function SKIN.getCount()return count end
|
||||
SKIN.lib={}
|
||||
SKIN.libMini={}
|
||||
|
||||
local function load(skip)
|
||||
for i=1,count do
|
||||
gc.push()
|
||||
gc.origin()
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
gc.setColor(1,1,1)
|
||||
SKIN.lib[i],SKIN.libMini[i]={},{}
|
||||
local N="media/image/skin/"..list[i]..".png"
|
||||
local I
|
||||
if love.filesystem.getInfo(N)then
|
||||
I=gc.newImage(N)
|
||||
else
|
||||
I=gc.newImage("media/image/skin/"..list[1]..".png")
|
||||
MES.new('warn',"No skin file: "..list[i])
|
||||
end
|
||||
gc.setDefaultFilter('linear','linear')
|
||||
for y=0,2 do
|
||||
for x=1,8 do
|
||||
SKIN.lib[i][8*y+x]=C(30,30)
|
||||
gc.draw(I,30-30*x,-30*y)
|
||||
|
||||
SKIN.libMini[i][8*y+x]=C(6,6)
|
||||
gc.draw(I,6-6*x,-6*y,nil,.2)
|
||||
end
|
||||
end
|
||||
I:release()
|
||||
gc.setCanvas()
|
||||
gc.pop()
|
||||
if not skip and i~=count then
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
SKIN.loadOne=nil
|
||||
SKIN.loadAll=nil
|
||||
|
||||
function SKIN.prevSet()--Prev skin_set
|
||||
local _=(SETTING.skinSet-2)%count+1
|
||||
SETTING.skinSet=_
|
||||
SKIN.change(_)
|
||||
_=list[_]
|
||||
TEXT.show(_,1100,100,int(300/#_)+5,'fly')
|
||||
end
|
||||
function SKIN.nextSet()--Next skin_set
|
||||
local _=SETTING.skinSet%count+1
|
||||
SETTING.skinSet=_
|
||||
SKIN.change(_)
|
||||
_=list[_]
|
||||
TEXT.show(_,1100,100,int(300/#_)+5,'fly')
|
||||
end
|
||||
function SKIN.change(i)--Change to skin_set[i]
|
||||
SKIN.curText=SKIN.lib[i]
|
||||
SKIN.curTextMini=SKIN.libMini[i]
|
||||
end
|
||||
local canvas=gc.newCanvas(x,y)
|
||||
gc.setCanvas(canvas)
|
||||
return canvas
|
||||
end
|
||||
|
||||
SKIN.loadOne=coroutine.wrap(load)
|
||||
function SKIN.loadAll()load(true)end
|
||||
SKIN.lib,SKIN.libMini={},{}
|
||||
local skinMeta={__index=function(self,name)
|
||||
gc.push()
|
||||
gc.origin()
|
||||
local f1,f2=gc.getDefaultFilter()
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
local I
|
||||
local N=Skins[name]
|
||||
if love.filesystem.getInfo(N)then
|
||||
I=gc.newImage(N)
|
||||
else
|
||||
MES.new('warn',"No skin file: "..Skins[name])
|
||||
end
|
||||
gc.setDefaultFilter(f1,f2)
|
||||
|
||||
SKIN.lib[name],SKIN.libMini[name]={},{}
|
||||
gc.setColor(1,1,1)
|
||||
for y=0,2 do
|
||||
for x=1,8 do
|
||||
SKIN.lib[name][8*y+x]=C(30,30)
|
||||
if I then gc.draw(I,30-30*x,-30*y)end
|
||||
|
||||
SKIN.libMini[name][8*y+x]=C(6,6)
|
||||
if I then gc.draw(I,6-6*x,-6*y,nil,.2)end
|
||||
end
|
||||
end
|
||||
gc.setCanvas()
|
||||
gc.pop()
|
||||
return self[name]
|
||||
end}
|
||||
setmetatable(SKIN.lib,skinMeta)
|
||||
setmetatable(SKIN.libMini,skinMeta)
|
||||
|
||||
function SKIN.loadAll()SKIN.loadAll=nil for _,v in next,list do local _=SKIN.lib[v.name]end end
|
||||
end
|
||||
return SKIN
|
||||
Reference in New Issue
Block a user