local component = require 'component' -- component for objects that have a position in the world local Transform = component() function Transform:init(inst) inst.pos = inst.pos or {0, 0} inst.angle = inst.angle or 0 inst.scale = inst.scale or {1, 1} if type(inst.scale) == 'number' then inst.scale = {inst.scale, inst.scale} end end function Transform:love(trans) local trans = trans or love.math.newTransform() local x, y = unpack(self.i.pos) local sx, sy = unpack(self.i.scale) trans:setTransformation(x, y, self.i.angle, sx, sy) return trans end local trans = love.math.newTransform() function Transform:use() self:love(trans) -- this is literally me love.graphics.applyTransform(trans) end return Transform