Skip to content

Commit

Permalink
框架跟进
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Dec 22, 2024
1 parent 9cc0985 commit cc033af
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 8 files
+5 −2 init.lua
+24 −15 midi.lua
+1 −0 scene.lua
+54 −47 sfx.lua
+3 −1 stringExtend.lua
+20 −6 tableExtend.lua
+10 −0 util.lua
+42 −70 widget.lua
8 changes: 4 additions & 4 deletions assets/game/mechanicLib/brik/allclearGenerator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ local function filterTop(field,pieces)
end
end
local function printField(f)
print("--------------------------")
local s=STRING.newBuf()
s:put("--------------------------")
for y=#f,1,-1 do
local s=""
for x=1,#f[y] do
s=s..(f[y][x] and 'X' or '.')
s:put(f[y][x] and "X" or ".")
end
print(s)
end
print(s)
end
local function printSeq(s)
s=TABLE.copy(s,0)
Expand Down
8 changes: 4 additions & 4 deletions assets/game/mechanicLib/brik/attackSys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,22 @@ modern={
end

do -- Text & Sound
local t=""
local t=STRING.newBuf()

-- Add CHG text & sound
if newCharge>oldCharge then
if newCharge>1 then
t=t..Text.charge.." "
t:put(Text.charge.." ")
P:playSound('charge',newCharge)
end
elseif oldCharge-newCharge>=2 then
t=t..Text.charge.." "
t:put(Text.charge.." ")
P:playSound('discharge')
end

-- Add spin text & sound
if tspin then
t=t..Text.spin:repD(M.brik.name).." "
t:put(Text.spin:repD(M.brik.name).." ")
P:playSound('spin',lines)
end

Expand Down
51 changes: 41 additions & 10 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,21 @@ FONT.load{
FONT.setDefaultFallback('symbols')
FONT.setDefaultFont('norm')
SCR.setSize(1600,1000)
local bFill=WIDGET.newClass('button_fill','button') do
do -- WIDGET.newClass
local bFill=WIDGET.newClass('button_fill','button')
local bInvis=WIDGET.newClass('button_invis','button')

local gc=love.graphics
local gc_push,gc_pop=gc.push,gc.pop
local gc_translate,gc_scale=gc.translate,gc.scale
local gc_setColor=gc.setColor
local alignDraw=WIDGET._alignDraw
function bFill:draw()
gc.push('transform')
gc.translate(self._x,self._y)
gc_push('transform')
gc_translate(self._x,self._y)

if self._pressTime>0 then
gc.scale(1-self._pressTime/self._pressTimeMax*.0626)
gc_scale(1-self._pressTime/self._pressTimeMax*.0626)
end

local w,h=self.w,self.h
Expand All @@ -238,19 +245,43 @@ local bFill=WIDGET.newClass('button_fill','button') do
local r,g,b=c[1],c[2],c[3]

-- Rectangle
gc.setColor(.15+r*.7*(1-HOV*.26),.15+g*.7*(1-HOV*.26),.15+b*.7*(1-HOV*.26),.9)
gc_setColor(.15+r*.7*(1-HOV*.26),.15+g*.7*(1-HOV*.26),.15+b*.7*(1-HOV*.26),.9)
GC.mRect('fill',0,0,w,h,self.cornerR)

-- Drawable
if self._image then
gc_setColor(1,1,1)
alignDraw(self,self._image)
end
if self._text then
gc_setColor(self.textColor)
alignDraw(self,self._text)
end
gc_pop()
end
function bInvis:draw()
gc_push('transform')
gc_translate(self._x,self._y)

local w,h=self.w,self.h
local HOV=self._hoverTime/self._hoverTimeMax

local fillC=self.fillColor

-- Rectangle
gc_setColor(fillC[1],fillC[2],fillC[3],HOV*.16)
GC.mRect('fill',0,0,w,h,self.cornerR)

-- Drawable
if self._image then
gc.setColor(1,1,1)
WIDGET._alignDraw(self,self._image)
gc_setColor(1,1,1)
alignDraw(self,self._image)
end
if self._text then
gc.setColor(self.textColor)
WIDGET._alignDraw(self,self._text)
gc_setColor(self.textColor)
alignDraw(self,self._text)
end
gc.pop()
gc_pop()
end
end
WIDGET.setDefaultOption{
Expand Down

0 comments on commit cc033af

Please sign in to comment.