Skip to content

Commit

Permalink
框架跟进
Browse files Browse the repository at this point in the history
  • Loading branch information
MrZ626 committed Dec 17, 2024
1 parent 8582026 commit 18d1c2c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Zenitha
4 changes: 2 additions & 2 deletions assets/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function PROGRESS.applyEnv(env)
PROGRESS.applyInteriorBGM()
ZENITHA.globalEvent.touchClick=NULL
ZENITHA.globalEvent.mouseDown=function(x,y) SYSFX.rectRipple(.26,x-10,y-10,20,20) end
function ZENITHA.globalEvent.drawCursor(_,x,y)
function ZENITHA.globalEvent.drawCursor(x,y)
if not SETTINGS.system.sysCursor then
gc.setColor(1,1,1)
gc.setLineWidth(2)
Expand All @@ -265,7 +265,7 @@ function PROGRESS.applyEnv(env)
else SYSFX.ripple(.26,x,y,26,.62,1,1)
end
end
function ZENITHA.globalEvent.drawCursor(_,x,y)
function ZENITHA.globalEvent.drawCursor(x,y)
if not SETTINGS.system.sysCursor then
gc.setColor(1,1,1)
gc.setLineWidth(2)
Expand Down
32 changes: 32 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,38 @@ FONT.load{
FONT.setDefaultFallback('symbols')
FONT.setDefaultFont('norm')
SCR.setSize(1600,1000)
local bFill=WIDGET.newClass('button_fill','button') do
local gc=love.graphics
function bFill:draw()
gc.push('transform')
gc.translate(self._x,self._y)

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

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

local c=self.fillColor
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.mRect('fill',0,0,w,h,self.cornerR)

-- Drawable
if self._image then
gc.setColor(1,1,1)
WIDGET._alignDraw(self,self._image)
end
if self._text then
gc.setColor(self.textColor)
WIDGET._alignDraw(self,self._text)
end
gc.pop()
end
end
WIDGET.setDefaultOption{
base={
lineWidth=2,
Expand Down

0 comments on commit 18d1c2c

Please sign in to comment.