epervier-framework/framework/scenes/gui/elements/assets.lua
Kazhnuz 4b088dac87 improvement(assets): global asset system
Remove the old scene-bound asset system and replace it with a global one. Can lazyload but doesn't do it for the moment.

Fixes #70
!BREAKING
2024-10-28 17:19:29 +01:00

16 lines
No EOL
548 B
Lua

local Parent = require "framework.scenes.gui.elements.drawable"
local AssetElement = Parent:extend()
function AssetElement:new(name, assetType, assetName, x, y,r,sx,sy,ox,oy, opacity)
self:initWrapper()
local asset = assets[assetType].get(assetName)
assert(asset ~= nil, assetName .. ' (' .. assetType .. ") doesn't exist")
AssetElement.super.new(self, name, asset, x, y,r,sx,sy,ox,oy, opacity)
end
function AssetElement:draw()
self.drawable:draw(self.x,self.y,self.r,self.sx,self.sy,self.ox,self.oy)
end
return AssetElement