dynamic sprite loading
This commit is contained in:
parent
c575497b3f
commit
738398fc2b
2 changed files with 21 additions and 3 deletions
11
conf.lua
11
conf.lua
|
@ -1,6 +1,8 @@
|
|||
function love.conf(t)
|
||||
t.version = "11.1"
|
||||
t.version = '11.1'
|
||||
t.release = false
|
||||
t.identity = 'notsanequarium'
|
||||
t.appendidentity = true
|
||||
t.window.title = 'notsanequarium'
|
||||
t.window.resizable = true
|
||||
t.window.vsync = false
|
||||
|
@ -9,6 +11,13 @@ function love.conf(t)
|
|||
t.window.width = 640
|
||||
t.window.height = 480
|
||||
|
||||
t.modules.physics = false
|
||||
t.modules.joystick = false
|
||||
t.modules.video = false
|
||||
t.modules.data = false
|
||||
t.modules.math = false
|
||||
t.modules.thread = false
|
||||
|
||||
-- t.window.msaa = 2
|
||||
|
||||
t.releases = {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
require 'lib.audio'
|
||||
|
||||
local assets = {}
|
||||
local rawsprites = {}
|
||||
|
||||
function assets.clear()
|
||||
print("ℹ️ clearing assets")
|
||||
|
||||
sprites = {}
|
||||
rawsprites = {}
|
||||
sound_path = {}
|
||||
music_path = {}
|
||||
end
|
||||
|
@ -13,8 +15,15 @@ end
|
|||
function assets.load(base)
|
||||
print("ℹ️ loading " .. base)
|
||||
|
||||
assets.addSprites(base)
|
||||
print("✓ added sprites")
|
||||
setmetatable(sprites, {__index = function(tbl, i)
|
||||
if rawsprites[i] then return rawsprites[i] end
|
||||
local sprite = love.graphics.newImage('assets/sprites/' .. i .. '.png')
|
||||
rawsprites[i] = sprite
|
||||
return sprite
|
||||
end})
|
||||
|
||||
--assets.addSprites(base)
|
||||
--print("✓ added sprites")
|
||||
|
||||
assets.addAudio(base)
|
||||
print("✓ added audio")
|
||||
|
|
Loading…
Reference in a new issue