From 31cb4b1ad93c7defad00f1f6616a7826ffca1a66 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 22 Apr 2021 00:46:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=A8=A1=E5=9D=97=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BF=AE=E6=94=B9=E6=98=BE=E7=A4=BA=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95=EF=BC=8C=E4=BF=AE=E5=A4=8Dkey?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E5=8F=B3=E5=AF=B9=E9=BD=90=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E9=94=99=E8=AF=AF=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=BB=E8=8F=9C=E5=8D=95=E5=BF=AB=E9=80=9F=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=86=85=E5=AE=B9=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 16 +++++++++++++++- parts/scenes/main.lua | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index f02474bf..509bad39 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -103,6 +103,13 @@ local button={ function button:reset() self.ATV=0 end +function button:setObject(obj) + if type(obj)=="string"or type(obj)=="number"then + self.obj=gc.newText(getFont(self.font),obj) + elseif obj then + self.obj=obj + end +end function button:isAbove(x,y) local ATV=self.ATV return @@ -219,6 +226,13 @@ local key={ function key:reset() self.ATV=0 end +function key:setObject(obj) + if type(obj)=="string"or type(obj)=="number"then + self.obj=gc.newText(getFont(self.font),obj) + elseif obj then + self.obj=obj + end +end function key:isAbove(x,y) return x>self.x and @@ -256,7 +270,7 @@ function key:draw() elseif self.align=="L"then mDraw_Y(self.obj,x+self.edge,y+h*.5) elseif self.align=="R"then - mDraw_Y(self.obj,x+w*.5,y+h*.5) + mDraw_Y(self.obj,self.x-self.edge-self.obj:getWidth(),y+h*.5) end end function key:getInfo() diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index a0aa4fa9..30256c5e 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -31,7 +31,7 @@ function scene.sceneInit() cmdEntryThread() --Set quick-play-button text - scene.widgetList[2].text=gc.newText(getFont(scene.widgetList[2].font),text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1]) + scene.widgetList[2]:setObject(text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1]) quickSure=false --Create demo player