From 2e73c6c332fe3e0b4f62a072352fd0cdab73f717 Mon Sep 17 00:00:00 2001 From: yuki Date: Tue, 11 Nov 2025 19:57:15 -0300 Subject: [PATCH] add pushRotateScale util --- main.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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