更新样例代码

This commit is contained in:
Kirigaya Kazuto 2019-08-07 03:35:00 +08:00
parent 5f1c518576
commit 84eda56087

View File

@ -1,15 +1,34 @@
wnd = Window("Hello", 1024, 768)
rnd = Renderer(wnd)
font = Font("asserts/msyh.ttf", 18)
music = Music("asserts/mp3/bgm1.mp3")
musicPlayer = MusicPlayer()
wnd:setTimeout(function()
print("Playing music")
musicPlayer:play(music)
print("Music started playing.")
end, 3000)
wnd:on('click', function(x, y)
print("Clicked", x, y)
rnd:clear()
local t = font:renderText(rnd, string.format("%f-%f", x, y), {r=255,g=255,b=255,a=0,type="color"})
rnd:copyTo(t, {x=x,y=y,type="point"})
rnd:update()
end)
wnd:on('quit', function()
print("before quit")
end)
wnd:on('keydown', function(key)
print("Keydown", key)
rnd:clear()
rnd:update()
wnd:setTimeout(function()
print("timer callback.")
rnd:clear()
rnd:copyTo(rnd:loadTexture("asserts/bqb/1.jpg"), {x=0,y=0,type="point"})
rnd:update()
end, 1000)
end)