add pushRotateScale util

This commit is contained in:
yuki 2025-11-11 19:57:15 -03:00
parent 0fff61f93c
commit 2e73c6c332

View file

@ -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