epervier-framework/framework/scenes/gui/elements/tile.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

19 lines
No EOL
644 B
Lua

local Parent = require "framework.scenes.gui.elements.drawable"
local TileElement = Parent:extend()
function TileElement:new(name, assetName, id, x, y,r,sx,sy,ox,oy, opacity)
self:initWrapper()
local asset = assets.tileset:get(assetName)
assert(asset ~= nil, assetName .. " ( tileset ) doesn't exist")
self.tileId = id
TileElement.super.new(self, name, asset, x, y,r,sx,sy,ox,oy, opacity)
end
function TileElement:draw()
love.graphics.setColor(1, 1, 1, self.opacity)
self.drawable:drawTile(self.tileId, self.x,self.y,self.r,self.sx,self.sy,self.ox,self.oy)
utils.graphics.resetColor()
end
return TileElement