diff options
Diffstat (limited to 'meta/3rd/love2d/library/love.math.lua')
-rw-r--r-- | meta/3rd/love2d/library/love.math.lua | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/meta/3rd/love2d/library/love.math.lua b/meta/3rd/love2d/library/love.math.lua index 2cc07c15..87d73bfb 100644 --- a/meta/3rd/love2d/library/love.math.lua +++ b/meta/3rd/love2d/library/love.math.lua @@ -13,16 +13,24 @@ love.math = {} ---@param gb number # Green color component in 0..255 range. ---@param bb number # Blue color component in 0..255 range. ---@param ab number # Alpha color component in 0..255 range. +---@return number r # Red color component in 0..1 range. +---@return number g # Green color component in 0..1 range. +---@return number b # Blue color component in 0..1 range. +---@return number a # Alpha color component in 0..1 range or nil if alpha is not specified. function love.math.colorFromBytes(rb, gb, bb, ab) end --- ---Converts a color from 0..1 to 0..255 range. --- +---@param r number # Red color component. +---@param g number # Green color component. +---@param b number # Blue color component. +---@param a number # Alpha color component. ---@return number rb # Red color component in 0..255 range. ---@return number gb # Green color component in 0..255 range. ---@return number bb # Blue color component in 0..255 range. ---@return number ab # Alpha color component in 0..255 range or nil if alpha is not specified. -function love.math.colorToBytes() end +function love.math.colorToBytes(r, g, b, a) end --- ---Compresses a string or data using a specific compression algorithm. @@ -52,10 +60,13 @@ function love.math.decompress(compressedData) end --- ---@overload fun(color: table):number, number, number ---@overload fun(c: number):number +---@param r number # The red channel of the sRGB color to convert. +---@param g number # The green channel of the sRGB color to convert. +---@param b number # The blue channel of the sRGB color to convert. ---@return number lr # The red channel of the converted color in linear RGB space. ---@return number lg # The green channel of the converted color in linear RGB space. ---@return number lb # The blue channel of the converted color in linear RGB space. -function love.math.gammaToLinear() end +function love.math.gammaToLinear(r, g, b) end --- ---Gets the seed of the random number generator. @@ -138,8 +149,9 @@ function love.math.newTransform() end ---@overload fun(x: number, y: number):number ---@overload fun(x: number, y: number, z: number):number ---@overload fun(x: number, y: number, z: number, w: number):number +---@param x number # The number used to generate the noise value. ---@return number value # The noise value in the range of 1. -function love.math.noise() end +function love.math.noise(x) end --- ---Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself. @@ -193,12 +205,18 @@ local BezierCurve = {} --- ---This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose. --- -function BezierCurve:evaluate() end +---@param t number # Where to evaluate the curve. +---@return number x # x coordinate of the curve at parameter t. +---@return number y # y coordinate of the curve at parameter t. +function BezierCurve:evaluate(t) end --- ---Get coordinates of the i-th control point. Indices start with 1. --- -function BezierCurve:getControlPoint() end +---@param i number # Index of the control point. +---@return number x # Position of the control point along the x axis. +---@return number y # Position of the control point along the y axis. +function BezierCurve:getControlPoint(i) end --- ---Get the number of control points in the Bézier curve. @@ -231,7 +249,10 @@ function BezierCurve:getSegment(startpoint, endpoint) end --- ---Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc. --- -function BezierCurve:insertControlPoint() end +---@param x number # Position of the control point along the x axis. +---@param y number # Position of the control point along the y axis. +---@param i number # Index of the control point. +function BezierCurve:insertControlPoint(x, y, i) end --- ---Removes the specified control point. @@ -274,14 +295,18 @@ function BezierCurve:rotate(angle, ox, oy) end --- ---Scale the Bézier curve by a factor. --- +---@param s number # Scale factor. ---@param ox number # X coordinate of the scaling center. ---@param oy number # Y coordinate of the scaling center. -function BezierCurve:scale(ox, oy) end +function BezierCurve:scale(s, ox, oy) end --- ---Set coordinates of the i-th control point. Indices start with 1. --- -function BezierCurve:setControlPoint() end +---@param i number # Index of the control point. +---@param x number # Position of the control point along the x axis. +---@param y number # Position of the control point along the y axis. +function BezierCurve:setControlPoint(i, x, y) end --- ---Move the Bézier curve by an offset. @@ -436,6 +461,8 @@ function Transform:setMatrix(e1_1, e1_2, e4_4) end --- ---Resets the Transform to the specified transformation parameters. --- +---@param x number # The position of the Transform on the x-axis. +---@param y number # The position of the Transform on the y-axis. ---@param angle number # The orientation of the Transform in radians. ---@param sx number # Scale factor on the x-axis. ---@param sy number # Scale factor on the y-axis. @@ -444,7 +471,7 @@ function Transform:setMatrix(e1_1, e1_2, e4_4) end ---@param kx number # Shearing / skew factor on the x-axis. ---@param ky number # Shearing / skew factor on the y-axis. ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. -function Transform:setTransformation(angle, sx, sy, ox, oy, kx, ky) end +function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end --- ---Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. |