add pushRotateScale util
This commit is contained in:
parent
0fff61f93c
commit
2e73c6c332
1 changed files with 14 additions and 0 deletions
14
main.lua
14
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue