Using Lily to speed up assets loading

This commit is contained in:
Nguyễn Quốc Hưng
2024-08-09 19:47:04 +07:00
parent 0a5bc1476d
commit 1a99de7435
5 changed files with 1072 additions and 60 deletions

View File

@@ -1,10 +1,21 @@
local LoadingScene = SCENE:extend()
local LoadingImageFile = love.graphics.newImage('res/loading.png')
function LoadingScene.update()
SCENE = SETTINGS.firstTime and InputConfigScene(true) or TitleScene()
if LOADED_BACKGROUND and LOADED_MUSIC then
SCENE = SETTINGS.firstTime and InputConfigScene(true) or TitleScene()
LILY.quit()
end
end
function LoadingScene.render()
love.graphics.draw(LOADING_IMAGE_FILE,0,0,0,0.5)
love.graphics.draw(LoadingImageFile,0,0,0,0.5)
drawText(
("Background: %s\nMusic & SFX: %s"):format(
LOADED_BACKGROUND and "loaded" or "...",
LOADED_MUSIC and "loaded" or "..."
),
15, 440, 1e99, "left"
)
end
return LoadingScene