diff --git a/src/assets.lua b/src/assets.lua index 9a7789a..83176d3 100644 --- a/src/assets.lua +++ b/src/assets.lua @@ -4,125 +4,164 @@ -- luacheck: ignore ---@type pd_image BigBat = playdate.graphics.image.new("images/game/BigBat.png") + -- luacheck: ignore ---@type pd_image DarkPlayerAwayBack = playdate.graphics.image.new("images/game/DarkPlayerAwayBack.png") + -- luacheck: ignore ---@type pd_image DarkPlayerAwayBase = playdate.graphics.image.new("images/game/DarkPlayerAwayBase.png") + -- luacheck: ignore ---@type pd_image DarkPlayerFrown = playdate.graphics.image.new("images/game/DarkPlayerFrown.png") + -- luacheck: ignore ---@type pd_image DarkPlayerHomeBack = playdate.graphics.image.new("images/game/DarkPlayerHomeBack.png") + -- luacheck: ignore ---@type pd_image DarkPlayerHomeBase = playdate.graphics.image.new("images/game/DarkPlayerHomeBase.png") + -- luacheck: ignore ---@type pd_image DarkPlayerSmile = playdate.graphics.image.new("images/game/DarkPlayerSmile.png") + -- luacheck: ignore ---@type pd_image DarkSkinFan = playdate.graphics.image.new("images/game/DarkSkinFan.png") + -- luacheck: ignore ---@type pd_image GameLogo = playdate.graphics.image.new("images/game/GameLogo.png") + -- luacheck: ignore ---@type pd_image Glove = playdate.graphics.image.new("images/game/Glove.png") + -- luacheck: ignore ---@type pd_image GloveHoldingBall = playdate.graphics.image.new("images/game/GloveHoldingBall.png") + -- luacheck: ignore ---@type pd_image GrassBackground = playdate.graphics.image.new("images/game/GrassBackground.png") + -- luacheck: ignore ---@type pd_image GrassBackgroundSmall = playdate.graphics.image.new("images/game/GrassBackgroundSmall.png") + -- luacheck: ignore ---@type pd_image Hat = playdate.graphics.image.new("images/game/Hat.png") + -- luacheck: ignore ---@type pd_image LightPlayerAwayBack = playdate.graphics.image.new("images/game/LightPlayerAwayBack.png") + -- luacheck: ignore ---@type pd_image LightPlayerAwayBase = playdate.graphics.image.new("images/game/LightPlayerAwayBase.png") + -- luacheck: ignore ---@type pd_image LightPlayerFrown = playdate.graphics.image.new("images/game/LightPlayerFrown.png") + -- luacheck: ignore ---@type pd_image LightPlayerHomeBack = playdate.graphics.image.new("images/game/LightPlayerHomeBack.png") + -- luacheck: ignore ---@type pd_image LightPlayerHomeBase = playdate.graphics.image.new("images/game/LightPlayerHomeBase.png") + -- luacheck: ignore ---@type pd_image LightPlayerSmile = playdate.graphics.image.new("images/game/LightPlayerSmile.png") + -- luacheck: ignore ---@type pd_image LightSkinFan = playdate.graphics.image.new("images/game/LightSkinFan.png") + -- luacheck: ignore ---@type pd_image MenuImage = playdate.graphics.image.new("images/game/MenuImage.png") + -- luacheck: ignore ---@type pd_image Minimap = playdate.graphics.image.new("images/game/Minimap.png") + -- luacheck: ignore ---@type pd_image PerfectPowerBg = playdate.graphics.image.new("images/game/PerfectPowerBg.png") + -- luacheck: ignore ---@type pd_image PerfectPowerFlickerLeft = playdate.graphics.image.new("images/game/PerfectPowerFlickerLeft.png") + -- luacheck: ignore ---@type pd_image PerfectPowerFlickerRight = playdate.graphics.image.new("images/game/PerfectPowerFlickerRight.png") + -- luacheck: ignore ---@type pd_sampleplayer BatCrackReverb = playdate.sound.sampleplayer.new("sounds/BatCrackReverb.wav") + -- luacheck: ignore ---@type pd_sampleplayer BootTune = playdate.sound.sampleplayer.new("music/BootTune.wav") + -- luacheck: ignore ---@type pd_sampleplayer BootTuneOrgany = playdate.sound.sampleplayer.new("music/BootTuneOrgany.wav") + -- luacheck: ignore ---@type pd_sampleplayer MenuMusic = playdate.sound.sampleplayer.new("music/MenuMusic.wav") + -- luacheck: ignore ---@type pd_sampleplayer TinnyBackground = playdate.sound.sampleplayer.new("music/TinnyBackground.wav") -Logos = { -{ name = "Base", image = playdate.graphics.image.new("images/game/logos/Base.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Arrows", image = playdate.graphics.image.new("images/game/logos/Arrows.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Cats", image = playdate.graphics.image.new("images/game/logos/Cats.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Checkmarks", image = playdate.graphics.image.new("images/game/logos/Checkmarks.png") }, --- luacheck: ignore ----@type pd_image -{ name = "FingerGuns", image = playdate.graphics.image.new("images/game/logos/FingerGuns.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Frown", image = playdate.graphics.image.new("images/game/logos/Frown.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Hearts", image = playdate.graphics.image.new("images/game/logos/Hearts.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Smiles", image = playdate.graphics.image.new("images/game/logos/Smiles.png") }, --- luacheck: ignore ----@type pd_image -{ name = "Turds", image = playdate.graphics.image.new("images/game/logos/Turds.png") }, +Logos = { + { name = "Base", image = playdate.graphics.image.new("images/game/logos/Base.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Arrows", image = playdate.graphics.image.new("images/game/logos/Arrows.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Cats", image = playdate.graphics.image.new("images/game/logos/Cats.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Checkmarks", image = playdate.graphics.image.new("images/game/logos/Checkmarks.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "FingerGuns", image = playdate.graphics.image.new("images/game/logos/FingerGuns.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Frown", image = playdate.graphics.image.new("images/game/logos/Frown.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Hearts", image = playdate.graphics.image.new("images/game/logos/Hearts.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Smiles", image = playdate.graphics.image.new("images/game/logos/Smiles.png") }, + + -- luacheck: ignore + ---@type pd_image + { name = "Turds", image = playdate.graphics.image.new("images/game/logos/Turds.png") }, + } diff --git a/src/assets.lua2p b/src/assets.lua2p index dd2b3ef..e5334d7 100644 --- a/src/assets.lua2p +++ b/src/assets.lua2p @@ -1,9 +1,10 @@ -!(function dirLookup(dir, extension, newFunc, type, sep, handle) - sep = sep or "\n" +!(function dirLookup(dir, extension, newFunc, type, sep, indent, handle) + indent = indent or "" + sep = sep or "\n\n" handle = handle ~= nil and handle or function(varName, value) return varName .. ' = ' .. value end - --Open directory look for files, save data in p. By giving '-type f' as parameter, it returns all files. + local p = io.popen('find src/' .. dir .. ' -maxdepth 1 -type f | sort -h') local assetCode = "" @@ -12,9 +13,9 @@ if file:find(extension) then local varName = file:gsub(".*/(.*)." .. extension, "%1") file = file:gsub("src/", "") - assetCode = assetCode .. '-- luacheck: ignore\n' - assetCode = assetCode .. '---@type ' .. type ..'\n' - assetCode = assetCode .. handle(varName, newFunc .. '("' .. file .. '")') .. sep + assetCode = assetCode .. indent .. '-- luacheck: ignore\n' + assetCode = assetCode .. indent .. '---@type ' .. type ..'\n' + assetCode = assetCode .. indent .. handle(varName, newFunc .. '("' .. file .. '")') .. sep end end return assetCode @@ -28,9 +29,9 @@ end)!!(generatedFileWarning()) !!(dirLookup('sounds', 'wav', 'playdate.sound.sampleplayer.new', 'pd_sampleplayer')) !!(dirLookup('music', 'wav', 'playdate.sound.sampleplayer.new', 'pd_sampleplayer')) Logos = { -{ name = "Base", image = playdate.graphics.image.new("images/game/logos/Base.png") }, + { name = "Base", image = playdate.graphics.image.new("images/game/logos/Base.png") }, -!!(dirLookup('images/game/logos -not -name "Base.png"', 'png', 'playdate.graphics.image.new', 'pd_image', ",\n", function(varName, value) +!!(dirLookup('images/game/logos -not -name "Base.png"', 'png', 'playdate.graphics.image.new', 'pd_image', ",\n\n", " ", function(varName, value) return '{ name = "' .. varName .. '", image = ' .. value .. ' }' end)) }