From 85cb55cdd0b07db97bc8a5cd5e9bd0de861ac344 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 7 Dec 2021 15:51:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=8E=A7=E4=BB=B6=E4=B9=9F?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E6=9C=80=E5=A4=A7=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 11 +++++++---- parts/scenes/customGame.lua | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 8378ab58..fb05d75f 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -72,20 +72,23 @@ function text:draw() if self.alpha>0 then local c=self.color gc_setColor(c[1],c[2],c[3],self.alpha) + local w=self.obj:getWidth() + local k=min(self.lim/self.obj:getWidth(),1) if self.align=='M'then - gc_draw(self.obj,self.x-self.obj:getWidth()*.5,self.y) + gc_draw(self.obj,self.x,self.y,nil,k,1,w*.5,0) elseif self.align=='L'then - gc_draw(self.obj,self.x,self.y) + gc_draw(self.obj,self.x,self.y,nil,k,1) elseif self.align=='R'then - gc_draw(self.obj,self.x-self.obj:getWidth(),self.y) + gc_draw(self.obj,self.x,self.y,nil,k,1,w,0) end end end -function WIDGET.newText(D)--name,x,y[,fText][,color][,font=30][,fType][,align='M'][,hideF][,hide] +function WIDGET.newText(D)--name,x,y[,lim][,fText][,color][,font=30][,fType][,align='M'][,hideF][,hide] local _={ name= D.name or"_", x= D.x, y= D.y, + lim= D.lim or 1e99, fText=D.fText, color=D.color and(COLOR[D.color]or D.color)or COLOR.Z, diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index 3561babe..df2e08a1 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -173,7 +173,7 @@ end scene.widgetScrollHeight=450 scene.widgetList={ - WIDGET.newText{name='title', x=520,y=15,font=70,align='R'}, + WIDGET.newText{name='title', x=40,y=15,lim=900,font=70,align='L'}, WIDGET.newKey{name='reset', x=1110,y=90,w=230,h=90,color='R',code=pressKey'delete'}, WIDGET.newKey{name='mod', x=1110,y=200,w=230,h=90,color='Z',code=pressKey'f1'},