From 15e011e334099a9c0c6bc34399fb90769600210f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 20 Jul 2021 17:20:24 +0800 Subject: update --- meta/3rd/love2d/library/love.math.lua | 95 +++++++++++++---------------------- 1 file changed, 34 insertions(+), 61 deletions(-) (limited to 'meta/3rd/love2d/library/love.math.lua') diff --git a/meta/3rd/love2d/library/love.math.lua b/meta/3rd/love2d/library/love.math.lua index 137d506d..2f63a8e8 100644 --- a/meta/3rd/love2d/library/love.math.lua +++ b/meta/3rd/love2d/library/love.math.lua @@ -1,3 +1,5 @@ +---@meta + ---@class love.math love.math = {} @@ -8,38 +10,30 @@ 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(r, g, b, a) end +function love.math.colorToBytes() end --- ---Compresses a string or data using a specific compression algorithm. --- ---@param rawstring string # The raw (un-compressed) string to compress. ----@param format love.math.CompressedDataFormat # The format to use when compressing the string. +---@param format love.CompressedDataFormat # The format to use when compressing the string. ---@param level number # The level of compression to use, between 0 and 9. -1 indicates the default level. The meaning of this argument depends on the compression format being used. ----@return love.math.CompressedData compressedData # A new Data object containing the compressed version of the string. +---@return love.CompressedData compressedData # A new Data object containing the compressed version of the string. function love.math.compress(rawstring, format, level) end --- ---Decompresses a CompressedData or previously compressed string or Data object. --- ----@param compressedData love.math.CompressedData # The compressed data to decompress. +---@param compressedData love.CompressedData # The compressed data to decompress. ---@return string rawstring # A string containing the raw decompressed data. function love.math.decompress(compressedData) end @@ -50,13 +44,10 @@ function love.math.decompress(compressedData) end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- ----@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(r, g, b) end +function love.math.gammaToLinear() end --- ---Gets the seed of the random number generator. @@ -107,19 +98,19 @@ function love.math.linearToGamma(lr, lg, lb) end ---The number of vertices in the control polygon determines the degree of the curve, e.g. three vertices define a quadratic (degree 2) Bézier curve, four vertices define a cubic (degree 3) Bézier curve, etc. --- ---@param vertices table # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. ----@return love.math.BezierCurve curve # A Bézier curve object. +---@return love.BezierCurve curve # A Bézier curve object. function love.math.newBezierCurve(vertices) end --- ---Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. --- ----@return love.math.RandomGenerator rng # The new Random Number Generator object. +---@return love.RandomGenerator rng # The new Random Number Generator object. function love.math.newRandomGenerator() end --- ---Creates a new Transform object. --- ----@return love.math.Transform transform # The new Transform object. +---@return love.Transform transform # The new Transform object. function love.math.newTransform() end --- @@ -129,9 +120,8 @@ function love.math.newTransform() end --- ---There are many webpages which discuss Perlin and Simplex noise in detail. --- ----@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(x) end +function love.math.noise() 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. @@ -168,7 +158,7 @@ function love.math.setRandomState(state) end ---@return table triangles # List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}. function love.math.triangulate(polygon) end ----@class love.math.BezierCurve: love.math.Object +---@class love.BezierCurve: love.Object local BezierCurve = {} --- @@ -176,18 +166,12 @@ 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. --- ----@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 +function BezierCurve:evaluate() end --- ---Get coordinates of the i-th control point. Indices start with 1. --- ----@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 +function BezierCurve:getControlPoint() end --- ---Get the number of control points in the Bézier curve. @@ -206,7 +190,7 @@ function BezierCurve:getDegree() end --- ---This function can be used to rotate sprites moving along a curve in the direction of the movement and compute the direction perpendicular to the curve at some parameter t. --- ----@return love.math.BezierCurve derivative # The derivative curve. +---@return love.BezierCurve derivative # The derivative curve. function BezierCurve:getDerivative() end --- @@ -214,16 +198,13 @@ function BezierCurve:getDerivative() end --- ---@param startpoint number # The starting point along the curve. Must be between 0 and 1. ---@param endpoint number # The end of the segment. Must be between 0 and 1. ----@return love.math.BezierCurve curve # A BezierCurve that corresponds to the specified segment. +---@return love.BezierCurve curve # A BezierCurve that corresponds to the specified segment. 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. --- ----@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 +function BezierCurve:insertControlPoint() end --- ---Removes the specified control point. @@ -266,18 +247,14 @@ 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(s, ox, oy) end +function BezierCurve:scale(ox, oy) end --- ---Set coordinates of the i-th control point. Indices start with 1. --- ----@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 +function BezierCurve:setControlPoint() end --- ---Move the Bézier curve by an offset. @@ -286,7 +263,7 @@ function BezierCurve:setControlPoint(i, x, y) end ---@param dy number # Offset along the y axis. function BezierCurve:translate(dx, dy) end ----@class love.math.RandomGenerator: love.math.Object +---@class love.RandomGenerator: love.Object local RandomGenerator = {} --- @@ -334,7 +311,7 @@ function RandomGenerator:setSeed(seed) end ---@param state string # The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState. function RandomGenerator:setState(state) end ----@class love.math.Transform: love.math.Object +---@class love.Transform: love.Object local Transform = {} --- @@ -342,14 +319,14 @@ local Transform = {} --- ---This effectively multiplies this Transform's internal transformation matrix with the other Transform's (i.e. self * other), and stores the result in this object. --- ----@param other love.math.Transform # The other Transform object to apply to this Transform. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@param other love.Transform # The other Transform object to apply to this Transform. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:apply(other) end --- ---Creates a new copy of this Transform. --- ----@return love.math.Transform clone # The copy of this Transform. +---@return love.Transform clone # The copy of this Transform. function Transform:clone() end --- @@ -357,14 +334,13 @@ function Transform:clone() end --- ---@return number e1_1 # The first column of the first row of the matrix. ---@return number e1_2 # The second column of the first row of the matrix. ----@return number ... # Additional matrix elements. ---@return number e4_4 # The fourth column of the fourth row of the matrix. function Transform:getMatrix() end --- ---Creates a new Transform containing the inverse of this Transform. --- ----@return love.math.Transform inverse # A new Transform object representing the inverse of this Transform's matrix. +---@return love.Transform inverse # A new Transform object representing the inverse of this Transform's matrix. function Transform:inverse() end --- @@ -389,14 +365,14 @@ function Transform:isAffine2DTransform() end --- ---Resets the Transform to an identity state. All previously applied transformations are erased. --- ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:reset() end --- ---Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations. --- ---@param angle number # The relative angle in radians to rotate this Transform by. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:rotate(angle) end --- @@ -404,7 +380,7 @@ function Transform:rotate(angle) end --- ---@param sx number # The relative scale factor along the x-axis. ---@param sy number # The relative scale factor along the y-axis. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:scale(sx, sy) end --- @@ -412,16 +388,13 @@ function Transform:scale(sx, sy) end --- ---@param e1_1 number # The first column of the first row of the matrix. ---@param e1_2 number # The second column of the first row of the matrix. ----@param ... number # Additional matrix elements. ---@param e4_4 number # The fourth column of the fourth row of the matrix. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. -function Transform:setMatrix(e1_1, e1_2, ..., e4_4) end +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +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. @@ -429,15 +402,15 @@ function Transform:setMatrix(e1_1, e1_2, ..., e4_4) end ---@param oy number # Origin offset on the y-axis. ---@param kx number # Shearing / skew factor on the x-axis. ---@param ky number # Shearing / skew factor on the y-axis. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. -function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end +---@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 --- ---Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. --- ---@param kx number # The shear factor along the x-axis. ---@param ky number # The shear factor along the y-axis. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:shear(kx, ky) end --- @@ -456,5 +429,5 @@ function Transform:transformPoint(globalX, globalY) end --- ---@param dx number # The relative translation along the x-axis. ---@param dy number # The relative translation along the y-axis. ----@return love.math.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. +---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. function Transform:translate(dx, dy) end -- cgit v1.2.3