测试场景改名并且加入一些功能

This commit is contained in:
MrZ626
2021-03-26 16:17:17 +08:00
parent b647b44c95
commit b4c781b7fd
3 changed files with 90 additions and 2 deletions

View File

@@ -485,7 +485,8 @@ function commands.theme(name)
end
end
function commands.demo()
SCN.go("empty","none")
SCN.go("test","none")
end
do--commands.applet(name)
local appList={"15p","grid","pong","atoz","uttt","cube","2048","ten","tap","dtw","cannon","drppper","calc","reflect","polyforge"}
local appScene={"app_15p","app_schulteG","app_pong","app_AtoZ","app_UTTT","app_cubefield","app_2048","app_ten","app_tap","app_dtw","app_cannon","app_dropper","app_calc","app_reflect","app_polyforge"}

View File

@@ -1 +0,0 @@
return{}

88
parts/scenes/test.lua Normal file
View File

@@ -0,0 +1,88 @@
local gc=love.graphics
local ins,rem=table.insert,table.remove
local scene={}
local list,timer
local function push(mes)
ins(list,{mes,120})
timer=1
end
function scene.sceneInit()
list={}
timer=0
love.keyboard.setKeyRepeat(false)
end
function scene.sceneBack()
list=nil
love.keyboard.setKeyRepeat(true)
end
function scene.gamepadDown(key)
push("[gamepadDown] <"..key..">")
end
function scene.gamepadUp(key)
push{COLOR.grey,"[gamepadUp] <"..key..">"}
end
function scene.keyDown(key)
push("[keyDown] <"..key..">")
end
function scene.keyUp(key)
push{COLOR.grey,"[keyUp] <"..key..">"}
end
function scene.mouseDown(x,y,k)
push(("[mouseDown] <%d: %d, %d>"):format(k,x,y))
end
function scene.mouseMove(x,y)
SYSFX.newShade(.5,x-3,y-3,7,7)
end
function scene.mouseUp(x,y,k)
SYSFX.newRectRipple(1,x-10,y-10,21,21)
push{COLOR.grey,"[mouseUp] <"..k..">"}
end
function scene.touchClick(x,y)
SYSFX.newRipple(.5,x,y,50)
push("[touchClick]")
end
function scene.touchDown(x,y)
SYSFX.newRipple(.5,x,y,50)
push(("[touchDown] <%d: %d, %d>"):format(x,y))
end
function scene.touchMove(x,y)
SYSFX.newRipple(.5,x,y,50)
end
function scene.touchUp(x,y)
SYSFX.newRipple(.5,x,y,50)
push{COLOR.grey,"[touchUp]"}
end
function scene.wheelMoved(dx,dy)
push(("[wheelMoved] <%d, %d>"):format(dx,dy))
end
function scene.update(dt)
if timer>0 then
timer=timer-dt/.526
end
for i=#list,1,-1 do
list[i][2]=list[i][2]-1
if list[i][2]==0 then
rem(list,i)
end
end
end
function scene.draw()
setFont(15)
for i=1,#list do
gc.setColor(1,1,1,list[i][2]/30)
gc.print(list[i][1],20,20*i)
end
end
scene.widgetList={
}
return scene