diff --git a/main.lua b/main.lua index c806814..11f6e89 100644 --- a/main.lua +++ b/main.lua @@ -152,6 +152,20 @@ function resize(s) sx, sy = s, s end +---Pushes a transformation stack for rotating and/or scaling +---@param x number horizontal coordinate to translate +---@param y number vertical coordinate to translate +---@param r number|nil angle to rotate +---@param sx number|nil horizontal scale +---@param sy number|nil vertical scale +function pushRotateScale(x, y, r, sx, sy) + love.graphics.push() + love.graphics.translate(x, y) + love.graphics.rotate(r or 0) + love.graphics.scale(sx or 1, sy or sx or 1) + love.graphics.translate(-x, -y) +end + ---Returns random number ---@param min number minimum of range ---@param max number maximum of range