From 3751ec2c3437e629d832087b5cc86d08d85c5f96 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 25 Jan 2021 15:24:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E7=95=8C=E9=9D=A2tips=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/main.lua | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index 0aa5451a..dc3f5d14 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -41,15 +41,18 @@ end local scene={} -local tip +local tip=gc.newText(getFont(30),"") +local scrollX function scene.sceneInit() - tip=text.getTip() + tip:set(text.getTip()) + scrollX=640 + BG.set() - GAME.modeEnv=NONE --Create demo player destroyPlayers() + GAME.modeEnv=NONE GAME.frame=0 GAME.seed=math.random(2e6) PLY.newDemoPlayer(1) @@ -62,16 +65,41 @@ function scene.update(dt) if GAME.frame>=36000 and GAME.frame%300==0 then PLAYERS[1]:movePosition(math.random(800,1000),math.random(50,310),.6) end + scrollX=scrollX-1.626 + if scrollX<-tip:getWidth()then + scrollX=640 + tip:set(text.getTip()) + end end +local function tipStencil() + gc.rectangle("fill",0,0,640,42) +end function scene.draw() gc.setColor(1,1,1) + + --Title + gc.draw(IMG.title_color,60,30,nil,1.3) + + --Quick play setFont(30) local L=text.modes[STAT.lastPlay] gc.print(L[1],700,210) gc.print(L[2],700,250) - gc.print(tip,50,660) - gc.draw(IMG.title_color,60,30,nil,1.3) + + --Tip + gc.push("transform") + gc.translate(50,660) + gc.setLineWidth(2) + gc.rectangle("line",0,0,640,42) + gc.stencil(tipStencil,"replace",1) + gc.setStencilTest("equal",1) + gc.draw(tip,0+scrollX,0) + gc.setColor(1,1,1,.2) + gc.setStencilTest() + gc.pop() + + --Player PLAYERS[1]:draw() end