main function
stringlengths
8
40
chunks
stringlengths
41
8.32k
repo_name
stringclasses
1 value
Joystick:getDeviceInfo
Joystick:getDeviceInfo Gets the USB vendor ID, product ID, and product version numbers of joystick which consistent across operating systems. Can be used to show different icons, etc. for different gamepads. vendorID, productID, productVersion = Joystick:getDeviceInfo() vendorID number The USB vendor ID of the joystick. productID number The USB product ID of the joystick. productVersion number The product version of the joystick.
love2d-community.github.io/love-api
Joystick:getGUID
Joystick:getGUID Gets a stable GUID unique to the type of the physical joystick which does not change over time. For example, all Sony Dualshock 3 controllers in OS X have the same GUID. The value is platform-dependent. guid = Joystick:getGUID() guid string The Joystick type's OS-dependent unique identifier.
love2d-community.github.io/love-api
Joystick:getGamepadAxis
Joystick:getGamepadAxis Gets the direction of a virtual gamepad axis. If the Joystick isn't recognized as a gamepad or isn't connected, this function will always return 0. direction = Joystick:getGamepadAxis( axis ) axis GamepadAxis The virtual axis to be checked. direction number Current value of the axis.
love2d-community.github.io/love-api
Joystick:getGamepadMapping
Joystick:getGamepadMapping Gets the button, axis or hat that a virtual gamepad input is bound to. inputtype, inputindex, hatdirection = Joystick:getGamepadMapping( axis ) axis GamepadAxis The virtual gamepad axis to get the binding for. inputtype JoystickInputType The type of input the virtual gamepad axis is bound to. inputindex number The index of the Joystick's button, axis or hat that the virtual gamepad axis is bound to. hatdirection JoystickHat The direction of the hat, if the virtual gamepad axis is bound to a hat. nil otherwise. inputtype, inputindex, hatdirection = Joystick:getGamepadMapping( button ) button GamepadButton The virtual gamepad button to get the binding for. inputtype JoystickInputType The type of input the virtual gamepad button is bound to. inputindex number The index of the Joystick's button, axis or hat that the virtual gamepad button is bound to. hatdirection JoystickHat The direction of the hat, if the virtual gamepad button is bound to a hat. nil otherwise.
love2d-community.github.io/love-api
Joystick:getGamepadMappingString
Joystick:getGamepadMappingString Gets the full gamepad mapping string of this Joystick, or nil if it's not recognized as a gamepad. The mapping string contains binding information used to map the Joystick's buttons an axes to the standard gamepad layout, and can be used later with love.joystick.loadGamepadMappings. mappingstring = Joystick:getGamepadMappingString() mappingstring string A string containing the Joystick's gamepad mappings, or nil if the Joystick is not recognized as a gamepad.
love2d-community.github.io/love-api
Joystick:getHat
Joystick:getHat Gets the direction of the Joystick's hat. direction = Joystick:getHat( hat ) hat number The index of the hat to be checked. direction JoystickHat The direction the hat is pushed.
love2d-community.github.io/love-api
Joystick:getHatCount
Joystick:getHatCount Gets the number of hats on the joystick. hats = Joystick:getHatCount() hats number How many hats the joystick has.
love2d-community.github.io/love-api
Joystick:getID
Joystick:getID Gets the joystick's unique identifier. The identifier will remain the same for the life of the game, even when the Joystick is disconnected and reconnected, but it '''will''' change when the game is re-launched. id, instanceid = Joystick:getID() id number The Joystick's unique identifier. Remains the same as long as the game is running. instanceid number Unique instance identifier. Changes every time the Joystick is reconnected. nil if the Joystick is not connected.
love2d-community.github.io/love-api
Joystick:getName
Joystick:getName Gets the name of the joystick. name = Joystick:getName() name string The name of the joystick.
love2d-community.github.io/love-api
Joystick:getVibration
Joystick:getVibration Gets the current vibration motor strengths on a Joystick with rumble support. left, right = Joystick:getVibration() left number Current strength of the left vibration motor on the Joystick. right number Current strength of the right vibration motor on the Joystick.
love2d-community.github.io/love-api
Joystick:isConnected
Joystick:isConnected Gets whether the Joystick is connected. connected = Joystick:isConnected() connected boolean True if the Joystick is currently connected, false otherwise.
love2d-community.github.io/love-api
Joystick:isDown
Joystick:isDown Checks if a button on the Joystick is pressed. LÖVE 0.9.0 had a bug which required the button indices passed to Joystick:isDown to be 0-based instead of 1-based, for example button 1 would be 0 for this function. It was fixed in 0.9.1. anyDown = Joystick:isDown( buttonN ) buttonN number The index of a button to check. anyDown boolean True if any supplied button is down, false if not.
love2d-community.github.io/love-api
Joystick:isGamepad
Joystick:isGamepad Gets whether the Joystick is recognized as a gamepad. If this is the case, the Joystick's buttons and axes can be used in a standardized manner across different operating systems and joystick models via Joystick:getGamepadAxis, Joystick:isGamepadDown, love.gamepadpressed, and related functions. LÖVE automatically recognizes most popular controllers with a similar layout to the Xbox 360 controller as gamepads, but you can add more with love.joystick.setGamepadMapping. isgamepad = Joystick:isGamepad() isgamepad boolean True if the Joystick is recognized as a gamepad, false otherwise.
love2d-community.github.io/love-api
Joystick:isGamepadDown
Joystick:isGamepadDown Checks if a virtual gamepad button on the Joystick is pressed. If the Joystick is not recognized as a Gamepad or isn't connected, then this function will always return false. anyDown = Joystick:isGamepadDown( buttonN ) buttonN GamepadButton The gamepad button to check. anyDown boolean True if any supplied button is down, false if not.
love2d-community.github.io/love-api
Joystick:isVibrationSupported
Joystick:isVibrationSupported Gets whether the Joystick supports vibration. supported = Joystick:isVibrationSupported() supported boolean True if rumble / force feedback vibration is supported on this Joystick, false if not.
love2d-community.github.io/love-api
Joystick:setVibration
Joystick:setVibration Sets the vibration motor speeds on a Joystick with rumble support. Most common gamepads have this functionality, although not all drivers give proper support. Use Joystick:isVibrationSupported to check. success = Joystick:setVibration( left, right ) left number Strength of the left vibration motor on the Joystick. Must be in the range of 1. right number Strength of the right vibration motor on the Joystick. Must be in the range of 1. success boolean True if the vibration was successfully applied, false if not. success = Joystick:setVibration() success boolean True if the vibration was successfully disabled, false if not. success = Joystick:setVibration( left, right, duration ) left number Strength of the left vibration motor on the Joystick. Must be in the range of 1. right number Strength of the right vibration motor on the Joystick. Must be in the range of 1. duration (-1) number The duration of the vibration in seconds. A negative value means infinite duration. success boolean True if the vibration was successfully applied, false if not.
love2d-community.github.io/love-api
love.keyboard.getKeyFromScancode
love.keyboard.getKeyFromScancode Gets the key corresponding to the given hardware scancode. Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. Scancodes are useful for creating default controls that have the same physical locations on on all systems. key = love.keyboard.getKeyFromScancode( scancode ) scancode Scancode The scancode to get the key from. key KeyConstant The key corresponding to the given scancode, or 'unknown' if the scancode doesn't map to a KeyConstant on the current system.
love2d-community.github.io/love-api
love.keyboard.getScancodeFromKey
love.keyboard.getScancodeFromKey Gets the hardware scancode corresponding to the given key. Unlike key constants, Scancodes are keyboard layout-independent. For example the scancode 'w' will be generated if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. Scancodes are useful for creating default controls that have the same physical locations on on all systems. scancode = love.keyboard.getScancodeFromKey( key ) key KeyConstant The key to get the scancode from. scancode Scancode The scancode corresponding to the given key, or 'unknown' if the given key has no known physical representation on the current system.
love2d-community.github.io/love-api
love.keyboard.hasKeyRepeat
love.keyboard.hasKeyRepeat Gets whether key repeat is enabled. enabled = love.keyboard.hasKeyRepeat() enabled boolean Whether key repeat is enabled.
love2d-community.github.io/love-api
love.keyboard.hasScreenKeyboard
love.keyboard.hasScreenKeyboard Gets whether screen keyboard is supported. supported = love.keyboard.hasScreenKeyboard() supported boolean Whether screen keyboard is supported.
love2d-community.github.io/love-api
love.keyboard.hasTextInput
love.keyboard.hasTextInput Gets whether text input events are enabled. enabled = love.keyboard.hasTextInput() enabled boolean Whether text input events are enabled.
love2d-community.github.io/love-api
love.keyboard.isDown
love.keyboard.isDown Checks whether a certain key is down. Not to be confused with love.keypressed or love.keyreleased. down = love.keyboard.isDown( key ) key KeyConstant The key to check. down boolean True if the key is down, false if not. anyDown = love.keyboard.isDown( key, ... ) key KeyConstant A key to check. ... KeyConstant Additional keys to check. anyDown boolean True if any supplied key is down, false if not.
love2d-community.github.io/love-api
love.keyboard.isScancodeDown
love.keyboard.isScancodeDown Checks whether the specified Scancodes are pressed. Not to be confused with love.keypressed or love.keyreleased. Unlike regular KeyConstants, Scancodes are keyboard layout-independent. The scancode 'w' is used if the key in the same place as the 'w' key on an American keyboard is pressed, no matter what the key is labelled or what the user's operating system settings are. down = love.keyboard.isScancodeDown( scancode, ... ) scancode Scancode A Scancode to check. ... Scancode Additional Scancodes to check. down boolean True if any supplied Scancode is down, false if not.
love2d-community.github.io/love-api
love.keyboard.setKeyRepeat
love.keyboard.setKeyRepeat Enables or disables key repeat for love.keypressed. It is disabled by default. love.keyboard.setKeyRepeat( enable ) enable boolean Whether repeat keypress events should be enabled when a key is held down.
love2d-community.github.io/love-api
love.keyboard.setTextInput
love.keyboard.setTextInput Enables or disables text input events. It is enabled by default on Windows, Mac, and Linux, and disabled by default on iOS and Android. On touch devices, this shows the system's native on-screen keyboard when it's enabled. love.keyboard.setTextInput( enable ) enable boolean Whether text input events should be enabled. love.keyboard.setTextInput( enable, x, y, w, h ) enable boolean Whether text input events should be enabled. x number Text rectangle x position. y number Text rectangle y position. w number Text rectangle width. h number Text rectangle height.
love2d-community.github.io/love-api
love.math.colorFromBytes
love.math.colorFromBytes Converts a color from 0..255 to 0..1 range. r, g, b, a = love.math.colorFromBytes( rb, gb, bb, ab ) rb number Red color component in 0..255 range. gb number Green color component in 0..255 range. bb number Blue color component in 0..255 range. ab (nil) number Alpha color component in 0..255 range. r number Red color component in 0..1 range. g number Green color component in 0..1 range. b number Blue color component in 0..1 range. a number Alpha color component in 0..1 range or nil if alpha is not specified.
love2d-community.github.io/love-api
love.math.colorToBytes
love.math.colorToBytes Converts a color from 0..1 to 0..255 range. rb, gb, bb, ab = love.math.colorToBytes( r, g, b, a ) r number Red color component. g number Green color component. b number Blue color component. a (nil) number Alpha color component. rb number Red color component in 0..255 range. gb number Green color component in 0..255 range. bb number Blue color component in 0..255 range. ab number Alpha color component in 0..255 range or nil if alpha is not specified.
love2d-community.github.io/love-api
love.math.gammaToLinear
love.math.gammaToLinear Converts a color from gamma-space (sRGB) to linear-space (RGB). This is useful when doing gamma-correct rendering and you need to do math in linear RGB in the few cases where LÖVE doesn't handle conversions automatically. Read more about gamma-correct rendering here, here, and here. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. lr, lg, lb = love.math.gammaToLinear( r, g, b ) r number The red channel of the sRGB color to convert. g number The green channel of the sRGB color to convert. b number The blue channel of the sRGB color to convert. lr number The red channel of the converted color in linear RGB space. lg number The green channel of the converted color in linear RGB space. lb number The blue channel of the converted color in linear RGB space. lr, lg, lb = love.math.gammaToLinear( color ) color table An array with the red, green, and blue channels of the sRGB color to convert. lr number The red channel of the converted color in linear RGB space. lg number The green channel of the converted color in linear RGB space. lb number The blue channel of the converted color in linear RGB space. lc = love.math.gammaToLinear( c ) c number The value of a color channel in sRGB space to convert. lc number The value of the color channel in linear RGB space.
love2d-community.github.io/love-api
love.math.getRandomSeed
love.math.getRandomSeed Gets the seed of the random number generator. The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed can be an integer value up to 2^64. low, high = love.math.getRandomSeed() low number Integer number representing the lower 32 bits of the random number generator's 64 bit seed value. high number Integer number representing the higher 32 bits of the random number generator's 64 bit seed value.
love2d-community.github.io/love-api
love.math.getRandomState
love.math.getRandomState Gets the current state of the random number generator. This returns an opaque implementation-dependent string which is only useful for later use with love.math.setRandomState or RandomGenerator:setState. This is different from love.math.getRandomSeed in that getRandomState gets the random number generator's current state, whereas getRandomSeed gets the previously set seed number. state = love.math.getRandomState() state string The current state of the random number generator, represented as a string.
love2d-community.github.io/love-api
love.math.isConvex
love.math.isConvex Checks whether a polygon is convex. PolygonShapes in love.physics, some forms of Meshes, and polygons drawn with love.graphics.polygon must be simple convex polygons. convex = love.math.isConvex( vertices ) vertices table The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. convex boolean Whether the given polygon is convex. convex = love.math.isConvex( x1, y1, x2, y2, ... ) x1 number The position of the first vertex of the polygon on the x-axis. y1 number The position of the first vertex of the polygon on the y-axis. x2 number The position of the second vertex of the polygon on the x-axis. y2 number The position of the second vertex of the polygon on the y-axis. ... number Additional position of the vertex of the polygon on the x-axis and y-axis. convex boolean Whether the given polygon is convex.
love2d-community.github.io/love-api
love.math.linearToGamma
love.math.linearToGamma Converts a color from linear-space (RGB) to gamma-space (sRGB). This is useful when storing linear RGB color values in an image, because the linear RGB color space has less precision than sRGB for dark colors, which can result in noticeable color banding when drawing. In general, colors chosen based on what they look like on-screen are already in gamma-space and should not be double-converted. Colors calculated using math are often in the linear RGB space. Read more about gamma-correct rendering here, here, and here. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. cr, cg, cb = love.math.linearToGamma( lr, lg, lb ) lr number The red channel of the linear RGB color to convert. lg number The green channel of the linear RGB color to convert. lb number The blue channel of the linear RGB color to convert. cr number The red channel of the converted color in gamma sRGB space. cg number The green channel of the converted color in gamma sRGB space. cb number The blue channel of the converted color in gamma sRGB space. cr, cg, cb = love.math.linearToGamma( color ) color table An array with the red, green, and blue channels of the linear RGB color to convert. cr number The red channel of the converted color in gamma sRGB space. cg number The green channel of the converted color in gamma sRGB space. cb number The blue channel of the converted color in gamma sRGB space. c = love.math.linearToGamma( lc ) lc number The value of a color channel in linear RGB space to convert. c number The value of the color channel in gamma sRGB space.
love2d-community.github.io/love-api
love.math.newBezierCurve
love.math.newBezierCurve Creates a new BezierCurve object. 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. curve = love.math.newBezierCurve( vertices ) vertices table The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}. curve BezierCurve A Bézier curve object. curve = love.math.newBezierCurve( x1, y1, x2, y2, ... ) x1 number The position of the first vertex of the control polygon on the x-axis. y1 number The position of the first vertex of the control polygon on the y-axis. x2 number The position of the second vertex of the control polygon on the x-axis. y2 number The position of the second vertex of the control polygon on the y-axis. ... number Additional position of the vertex of the control polygon on the x-axis and y-axis. curve BezierCurve A Bézier curve object.
love2d-community.github.io/love-api
love.math.newRandomGenerator
love.math.newRandomGenerator Creates a new RandomGenerator object which is completely independent of other RandomGenerator objects and random functions. rng = love.math.newRandomGenerator() rng RandomGenerator The new Random Number Generator object. rng = love.math.newRandomGenerator( seed ) seed number The initial seed number to use for this object. rng RandomGenerator The new Random Number Generator object. rng = love.math.newRandomGenerator( low, high ) low number The lower 32 bits of the seed number to use for this object. high number The higher 32 bits of the seed number to use for this object. rng RandomGenerator The new Random Number Generator object.
love2d-community.github.io/love-api
love.math.newTransform
love.math.newTransform Creates a new Transform object. transform = love.math.newTransform() transform Transform The new Transform object. transform = love.math.newTransform( x, y, angle, sx, sy, ox, oy, kx, ky ) x number The position of the new Transform on the x-axis. y number The position of the new Transform on the y-axis. angle (0) number The orientation of the new Transform in radians. sx (1) number Scale factor on the x-axis. sy (sx) number Scale factor on the y-axis. ox (0) number Origin offset on the x-axis. oy (0) number Origin offset on the y-axis. kx (0) number Shearing / skew factor on the x-axis. ky (0) number Shearing / skew factor on the y-axis. transform Transform The new Transform object.
love2d-community.github.io/love-api
love.math.noise
love.math.noise Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments. Simplex noise is closely related to Perlin noise. It is widely used for procedural content generation. There are many webpages which discuss Perlin and Simplex noise in detail. value = love.math.noise( x ) x number The number used to generate the noise value. value number The noise value in the range of 1. value = love.math.noise( x, y ) x number The first value of the 2-dimensional vector used to generate the noise value. y number The second value of the 2-dimensional vector used to generate the noise value. value number The noise value in the range of 1. value = love.math.noise( x, y, z ) x number The first value of the 3-dimensional vector used to generate the noise value. y number The second value of the 3-dimensional vector used to generate the noise value. z number The third value of the 3-dimensional vector used to generate the noise value. value number The noise value in the range of 1. value = love.math.noise( x, y, z, w ) x number The first value of the 4-dimensional vector used to generate the noise value. y number The second value of the 4-dimensional vector used to generate the noise value. z number The third value of the 4-dimensional vector used to generate the noise value. w number The fourth value of the 4-dimensional vector used to generate the noise value. value number The noise value in the range of 1.
love2d-community.github.io/love-api
love.math.random
love.math.random 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. number = love.math.random() number number The pseudo-random number. number = love.math.random( max ) max number The maximum possible value it should return. number number The pseudo-random integer number. number = love.math.random( min, max ) min number The minimum possible value it should return. max number The maximum possible value it should return. number number The pseudo-random integer number.
love2d-community.github.io/love-api
love.math.randomNormal
love.math.randomNormal Get a normally distributed pseudo random number. number = love.math.randomNormal( stddev, mean ) stddev (1) number Standard deviation of the distribution. mean (0) number The mean of the distribution. number number Normally distributed random number with variance (stddev)² and the specified mean.
love2d-community.github.io/love-api
love.math.setRandomSeed
love.math.setRandomSeed Sets the seed of the random number generator using the specified integer number. This is called internally at startup, so you generally don't need to call it yourself. love.math.setRandomSeed( seed ) seed number The integer number with which you want to seed the randomization. Must be within the range of 2^53 - 1. love.math.setRandomSeed( low, high ) low number The lower 32 bits of the seed value. Must be within the range of 2^32 - 1. high number The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.
love2d-community.github.io/love-api
love.math.setRandomState
love.math.setRandomState Sets the current state of the random number generator. The value used as an argument for this function is an opaque implementation-dependent string and should only originate from a previous call to love.math.getRandomState. This is different from love.math.setRandomSeed in that setRandomState directly sets the random number generator's current implementation-dependent state, whereas setRandomSeed gives it a new seed value. love.math.setRandomState( state ) state string The new state of the random number generator, represented as a string. This should originate from a previous call to love.math.getRandomState.
love2d-community.github.io/love-api
love.math.triangulate
love.math.triangulate Decomposes a simple convex or concave polygon into triangles. triangles = love.math.triangulate( polygon ) polygon table Polygon to triangulate. Must not intersect itself. triangles table List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}. triangles = love.math.triangulate( x1, y1, x2, y2, x3, y3 ) x1 number The position of the first vertex of the polygon on the x-axis. y1 number The position of the first vertex of the polygon on the y-axis. x2 number The position of the second vertex of the polygon on the x-axis. y2 number The position of the second vertex of the polygon on the y-axis. x3 number The position of the third vertex of the polygon on the x-axis. y3 number The position of the third vertex of the polygon on the y-axis. triangles table List of triangles the polygon is composed of, in the form of {{x1, y1, x2, y2, x3, y3}, {x1, y1, x2, y2, x3, y3}, ...}.
love2d-community.github.io/love-api
BezierCurve:evaluate
BezierCurve:evaluate Evaluate Bézier curve at parameter t. The parameter must be between 0 and 1 (inclusive). 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. x, y = BezierCurve:evaluate( t ) t number Where to evaluate the curve. x number x coordinate of the curve at parameter t. y number y coordinate of the curve at parameter t.
love2d-community.github.io/love-api
BezierCurve:getControlPoint
BezierCurve:getControlPoint Get coordinates of the i-th control point. Indices start with 1. x, y = BezierCurve:getControlPoint( i ) i number Index of the control point. x number Position of the control point along the x axis. y number Position of the control point along the y axis.
love2d-community.github.io/love-api
BezierCurve:getControlPointCount
BezierCurve:getControlPointCount Get the number of control points in the Bézier curve. count = BezierCurve:getControlPointCount() count number The number of control points.
love2d-community.github.io/love-api
BezierCurve:getDegree
BezierCurve:getDegree Get degree of the Bézier curve. The degree is equal to number-of-control-points - 1. degree = BezierCurve:getDegree() degree number Degree of the Bézier curve.
love2d-community.github.io/love-api
BezierCurve:getDerivative
BezierCurve:getDerivative Get the derivative of the Bézier curve. 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. derivative = BezierCurve:getDerivative() derivative BezierCurve The derivative curve.
love2d-community.github.io/love-api
BezierCurve:getSegment
BezierCurve:getSegment Gets a BezierCurve that corresponds to the specified segment of this BezierCurve. curve = BezierCurve:getSegment( startpoint, endpoint ) startpoint number The starting point along the curve. Must be between 0 and 1. endpoint number The end of the segment. Must be between 0 and 1. curve BezierCurve A BezierCurve that corresponds to the specified segment.
love2d-community.github.io/love-api
BezierCurve:insertControlPoint
BezierCurve:insertControlPoint 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. BezierCurve:insertControlPoint( x, y, i ) x number Position of the control point along the x axis. y number Position of the control point along the y axis. i (-1) number Index of the control point.
love2d-community.github.io/love-api
BezierCurve:removeControlPoint
BezierCurve:removeControlPoint Removes the specified control point. BezierCurve:removeControlPoint( index ) index number The index of the control point to remove.
love2d-community.github.io/love-api
BezierCurve:render
BezierCurve:render Get a list of coordinates to be used with love.graphics.line. This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. If you are just interested to know the position on the curve given a parameter, use BezierCurve:evaluate. coordinates = BezierCurve:render( depth ) depth (5) number Number of recursive subdivision steps. coordinates table List of x,y-coordinate pairs of points on the curve.
love2d-community.github.io/love-api
BezierCurve:renderSegment
BezierCurve:renderSegment Get a list of coordinates on a specific part of the curve, to be used with love.graphics.line. This function samples the Bézier curve using recursive subdivision. You can control the recursion depth using the depth parameter. If you are just need to know the position on the curve given a parameter, use BezierCurve:evaluate. coordinates = BezierCurve:renderSegment( startpoint, endpoint, depth ) startpoint number The starting point along the curve. Must be between 0 and 1. endpoint number The end of the segment to render. Must be between 0 and 1. depth (5) number Number of recursive subdivision steps. coordinates table List of x,y-coordinate pairs of points on the specified part of the curve.
love2d-community.github.io/love-api
BezierCurve:rotate
BezierCurve:rotate Rotate the Bézier curve by an angle. BezierCurve:rotate( angle, ox, oy ) angle number Rotation angle in radians. ox (0) number X coordinate of the rotation center. oy (0) number Y coordinate of the rotation center.
love2d-community.github.io/love-api
BezierCurve:scale
BezierCurve:scale Scale the Bézier curve by a factor. BezierCurve:scale( s, ox, oy ) s number Scale factor. ox (0) number X coordinate of the scaling center. oy (0) number Y coordinate of the scaling center.
love2d-community.github.io/love-api
BezierCurve:setControlPoint
BezierCurve:setControlPoint Set coordinates of the i-th control point. Indices start with 1. BezierCurve:setControlPoint( i, x, y ) i number Index of the control point. x number Position of the control point along the x axis. y number Position of the control point along the y axis.
love2d-community.github.io/love-api
BezierCurve:translate
BezierCurve:translate Move the Bézier curve by an offset. BezierCurve:translate( dx, dy ) dx number Offset along the x axis. dy number Offset along the y axis.
love2d-community.github.io/love-api
RandomGenerator:getSeed
RandomGenerator:getSeed Gets the seed of the random number generator object. The seed is split into two numbers due to Lua's use of doubles for all number values - doubles can't accurately represent integer values above 2^53, but the seed value is an integer number in the range of 2^64 - 1. low, high = RandomGenerator:getSeed() low number Integer number representing the lower 32 bits of the RandomGenerator's 64 bit seed value. high number Integer number representing the higher 32 bits of the RandomGenerator's 64 bit seed value.
love2d-community.github.io/love-api
RandomGenerator:getState
RandomGenerator:getState Gets the current state of the random number generator. This returns an opaque string which is only useful for later use with RandomGenerator:setState in the same major version of LÖVE. This is different from RandomGenerator:getSeed in that getState gets the RandomGenerator's current state, whereas getSeed gets the previously set seed number. state = RandomGenerator:getState() state string The current state of the RandomGenerator object, represented as a string.
love2d-community.github.io/love-api
RandomGenerator:random
RandomGenerator:random Generates a pseudo-random number in a platform independent manner. number = RandomGenerator:random() number number The pseudo-random number. number = RandomGenerator:random( max ) max number The maximum possible value it should return. number number The pseudo-random integer number. number = RandomGenerator:random( min, max ) min number The minimum possible value it should return. max number The maximum possible value it should return. number number The pseudo-random integer number.
love2d-community.github.io/love-api
RandomGenerator:randomNormal
RandomGenerator:randomNormal Get a normally distributed pseudo random number. number = RandomGenerator:randomNormal( stddev, mean ) stddev (1) number Standard deviation of the distribution. mean (0) number The mean of the distribution. number number Normally distributed random number with variance (stddev)² and the specified mean.
love2d-community.github.io/love-api
RandomGenerator:setSeed
RandomGenerator:setSeed Sets the seed of the random number generator using the specified integer number. RandomGenerator:setSeed( seed ) seed number The integer number with which you want to seed the randomization. Must be within the range of 2^53. RandomGenerator:setSeed( low, high ) low number The lower 32 bits of the seed value. Must be within the range of 2^32 - 1. high number The higher 32 bits of the seed value. Must be within the range of 2^32 - 1.
love2d-community.github.io/love-api
RandomGenerator:setState
RandomGenerator:setState Sets the current state of the random number generator. The value used as an argument for this function is an opaque string and should only originate from a previous call to RandomGenerator:getState in the same major version of LÖVE. This is different from RandomGenerator:setSeed in that setState directly sets the RandomGenerator's current implementation-dependent state, whereas setSeed gives it a new seed value. RandomGenerator:setState( state ) state string The new state of the RandomGenerator object, represented as a string. This should originate from a previous call to RandomGenerator:getState.
love2d-community.github.io/love-api
Transform:apply
Transform:apply Applies the given other Transform object to this one. 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. transform = Transform:apply( other ) other Transform The other Transform object to apply to this Transform. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:clone
Transform:clone Creates a new copy of this Transform. clone = Transform:clone() clone Transform The copy of this Transform.
love2d-community.github.io/love-api
Transform:getMatrix
Transform:getMatrix Gets the internal 4x4 transformation matrix stored by this Transform. The matrix is returned in row-major order. e1_1, e1_2, e1_3, e1_4, e2_1, e2_2, e2_3, e2_4, e3_1, e3_2, e3_3, e3_4, e4_1, e4_2, e4_3, e4_4 = Transform:getMatrix() e1_1 number The first column of the first row of the matrix. e1_2 number The second column of the first row of the matrix. e1_3 number The third column of the first row of the matrix. e1_4 number The fourth column of the first row of the matrix. e2_1 number The first column of the second row of the matrix. e2_2 number The second column of the second row of the matrix. e2_3 number The third column of the second row of the matrix. e2_4 number The fourth column of the second row of the matrix. e3_1 number The first column of the third row of the matrix. e3_2 number The second column of the third row of the matrix. e3_3 number The third column of the third row of the matrix. e3_4 number The fourth column of the third row of the matrix. e4_1 number The first column of the fourth row of the matrix. e4_2 number The second column of the fourth row of the matrix. e4_3 number The third column of the fourth row of the matrix. e4_4 number The fourth column of the fourth row of the matrix.
love2d-community.github.io/love-api
Transform:inverse
Transform:inverse Creates a new Transform containing the inverse of this Transform. inverse = Transform:inverse() inverse Transform A new Transform object representing the inverse of this Transform's matrix.
love2d-community.github.io/love-api
Transform:inverseTransformPoint
Transform:inverseTransformPoint Applies the reverse of the Transform object's transformation to the given 2D position. This effectively converts the given position from the local coordinate space of the Transform into global coordinates. One use of this method can be to convert a screen-space mouse position into global world coordinates, if the given Transform has transformations applied that are used for a camera system in-game. globalX, globalY = Transform:inverseTransformPoint( localX, localY ) localX number The x component of the position with the transform applied. localY number The y component of the position with the transform applied. globalX number The x component of the position in global coordinates. globalY number The y component of the position in global coordinates.
love2d-community.github.io/love-api
Transform:isAffine2DTransform
Transform:isAffine2DTransform Checks whether the Transform is an affine transformation. affine = Transform:isAffine2DTransform() affine boolean true if the transform object is an affine transformation, false otherwise.
love2d-community.github.io/love-api
Transform:reset
Transform:reset Resets the Transform to an identity state. All previously applied transformations are erased. transform = Transform:reset() transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:rotate
Transform:rotate Applies a rotation to the Transform's coordinate system. This method does not reset any previously applied transformations. transform = Transform:rotate( angle ) angle number The relative angle in radians to rotate this Transform by. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:scale
Transform:scale Scales the Transform's coordinate system. This method does not reset any previously applied transformations. transform = Transform:scale( sx, sy ) sx number The relative scale factor along the x-axis. sy (sx) number The relative scale factor along the y-axis. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:setMatrix
Transform:setMatrix Directly sets the Transform's internal 4x4 transformation matrix. transform = Transform:setMatrix( e1_1, e1_2, e1_3, e1_4, e2_1, e2_2, e2_3, e2_4, e3_1, e3_2, e3_3, e3_4, e4_1, e4_2, e4_3, e4_4 ) e1_1 number The first column of the first row of the matrix. e1_2 number The second column of the first row of the matrix. e1_3 number The third column of the first row of the matrix. e1_4 number The fourth column of the first row of the matrix. e2_1 number The first column of the second row of the matrix. e2_2 number The second column of the second row of the matrix. e2_3 number The third column of the second row of the matrix. e2_4 number The fourth column of the second row of the matrix. e3_1 number The first column of the third row of the matrix. e3_2 number The second column of the third row of the matrix. e3_3 number The third column of the third row of the matrix. e3_4 number The fourth column of the third row of the matrix. e4_1 number The first column of the fourth row of the matrix. e4_2 number The second column of the fourth row of the matrix. e4_3 number The third column of the fourth row of the matrix. e4_4 number The fourth column of the fourth row of the matrix. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods. transform = Transform:setMatrix( layout, e1_1, e1_2, e1_3, e1_4, e2_1, e2_2, e2_3, e2_4, e3_1, e3_2, e3_3, e3_4, e4_1, e4_2, e4_3, e4_4 ) layout MatrixLayout How to interpret the matrix element arguments (row-major or column-major). e1_1 number The first column of the first row of the matrix. e1_2 number The second column of the first row or the first column of the second row of the matrix, depending on the specified layout. e1_3 number The third column/row of the first row/column of the matrix. e1_4 number The fourth column/row of the first row/column of the matrix. e2_1 number The first column/row of the second row/column of the matrix. e2_2 number The second column/row of the second row/column of the matrix. e2_3 number The third column/row of the second row/column of the matrix. e2_4 number The fourth column/row of the second row/column of the matrix. e3_1 number The first column/row of the third row/column of the matrix. e3_2 number The second column/row of the third row/column of the matrix. e3_3 number The third column/row of the third row/column of the matrix. e3_4 number The fourth column/row of the third row/column of the matrix. e4_1 number The first column/row of the fourth row/column of the matrix. e4_2 number The second column/row of the fourth row/column of the matrix. e4_3 number The third column/row of the fourth row/column of the matrix. e4_4 number The fourth column of the fourth row of the matrix. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods. transform = Transform:setMatrix( layout, matrix ) layout MatrixLayout How to interpret the matrix element arguments (row-major or column-major). matrix table A flat table containing the 16 matrix elements. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods. transform = Transform:setMatrix( layout, matrix ) layout MatrixLayout How to interpret the matrix element arguments (row-major or column-major). matrix table A table of 4 tables, with each sub-table containing 4 matrix elements. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:setTransformation
Transform:setTransformation Resets the Transform to the specified transformation parameters. transform = Transform:setTransformation( x, y, angle, sx, sy, ox, oy, kx, ky ) x number The position of the Transform on the x-axis. y number The position of the Transform on the y-axis. angle (0) number The orientation of the Transform in radians. sx (1) number Scale factor on the x-axis. sy (sx) number Scale factor on the y-axis. ox (0) number Origin offset on the x-axis. oy (0) number Origin offset on the y-axis. kx (0) number Shearing / skew factor on the x-axis. ky (0) number Shearing / skew factor on the y-axis. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:shear
Transform:shear Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. transform = Transform:shear( kx, ky ) kx number The shear factor along the x-axis. ky number The shear factor along the y-axis. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
Transform:transformPoint
Transform:transformPoint Applies the Transform object's transformation to the given 2D position. This effectively converts the given position from global coordinates into the local coordinate space of the Transform. localX, localY = Transform:transformPoint( globalX, globalY ) globalX number The x component of the position in global coordinates. globalY number The y component of the position in global coordinates. localX number The x component of the position with the transform applied. localY number The y component of the position with the transform applied.
love2d-community.github.io/love-api
Transform:translate
Transform:translate Applies a translation to the Transform's coordinate system. This method does not reset any previously applied transformations. transform = Transform:translate( dx, dy ) dx number The relative translation along the x-axis. dy number The relative translation along the y-axis. transform Transform The Transform object the method was called on. Allows easily chaining Transform methods.
love2d-community.github.io/love-api
love.mouse.getCursor
love.mouse.getCursor Gets the current Cursor. cursor = love.mouse.getCursor() cursor Cursor The current cursor, or nil if no cursor is set.
love2d-community.github.io/love-api
love.mouse.getPosition
love.mouse.getPosition Returns the current position of the mouse. x, y = love.mouse.getPosition() x number The position of the mouse along the x-axis. y number The position of the mouse along the y-axis.
love2d-community.github.io/love-api
love.mouse.getRelativeMode
love.mouse.getRelativeMode Gets whether relative mode is enabled for the mouse. If relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. The reported position of the mouse is not updated while relative mode is enabled, even when relative mouse motion events are generated. enabled = love.mouse.getRelativeMode() enabled boolean True if relative mode is enabled, false if it's disabled.
love2d-community.github.io/love-api
love.mouse.getSystemCursor
love.mouse.getSystemCursor Gets a Cursor object representing a system-native hardware cursor. Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. cursor = love.mouse.getSystemCursor( ctype ) ctype CursorType The type of system cursor to get. cursor Cursor The Cursor object representing the system cursor type.
love2d-community.github.io/love-api
love.mouse.getX
love.mouse.getX Returns the current x-position of the mouse. x = love.mouse.getX() x number The position of the mouse along the x-axis.
love2d-community.github.io/love-api
love.mouse.getY
love.mouse.getY Returns the current y-position of the mouse. y = love.mouse.getY() y number The position of the mouse along the y-axis.
love2d-community.github.io/love-api
love.mouse.isCursorSupported
love.mouse.isCursorSupported Gets whether cursor functionality is supported. If it isn't supported, calling love.mouse.newCursor and love.mouse.getSystemCursor will cause an error. Mobile devices do not support cursors. supported = love.mouse.isCursorSupported() supported boolean Whether the system has cursor functionality.
love2d-community.github.io/love-api
love.mouse.isDown
love.mouse.isDown Checks whether a certain mouse button is down. This function does not detect mouse wheel scrolling; you must use the love.wheelmoved (or love.mousepressed in version 0.9.2 and older) callback for that. down = love.mouse.isDown( button, ... ) button number The index of a button to check. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependant. ... number Additional button numbers to check. down boolean True if any specified button is down.
love2d-community.github.io/love-api
love.mouse.isGrabbed
love.mouse.isGrabbed Checks if the mouse is grabbed. grabbed = love.mouse.isGrabbed() grabbed boolean True if the cursor is grabbed, false if it is not.
love2d-community.github.io/love-api
love.mouse.isVisible
love.mouse.isVisible Checks if the cursor is visible. visible = love.mouse.isVisible() visible boolean True if the cursor to visible, false if the cursor is hidden.
love2d-community.github.io/love-api
love.mouse.newCursor
love.mouse.newCursor Creates a new hardware Cursor object from an image file or ImageData. Hardware cursors are framerate-independent and work the same way as normal operating system cursors. Unlike drawing an image at the mouse's current coordinates, hardware cursors never have visible lag between when the mouse is moved and when the cursor position updates, even at low framerates. The hot spot is the point the operating system uses to determine what was clicked and at what position the mouse cursor is. For example, the normal arrow pointer normally has its hot spot at the top left of the image, but a crosshair cursor might have it in the middle. cursor = love.mouse.newCursor( imageData, hotx, hoty ) imageData ImageData The ImageData to use for the new Cursor. hotx (0) number The x-coordinate in the ImageData of the cursor's hot spot. hoty (0) number The y-coordinate in the ImageData of the cursor's hot spot. cursor Cursor The new Cursor object. cursor = love.mouse.newCursor( filename, hotx, hoty ) filename string Path to the image to use for the new Cursor. hotx (0) number The x-coordinate in the image of the cursor's hot spot. hoty (0) number The y-coordinate in the image of the cursor's hot spot. cursor Cursor The new Cursor object. cursor = love.mouse.newCursor( fileData, hotx, hoty ) fileData FileData Data representing the image to use for the new Cursor. hotx (0) number The x-coordinate in the image of the cursor's hot spot. hoty (0) number The y-coordinate in the image of the cursor's hot spot. cursor Cursor The new Cursor object.
love2d-community.github.io/love-api
love.mouse.setCursor
love.mouse.setCursor Sets the current mouse cursor. love.mouse.setCursor( cursor ) cursor Cursor The Cursor object to use as the current mouse cursor. love.mouse.setCursor()
love2d-community.github.io/love-api
love.mouse.setGrabbed
love.mouse.setGrabbed Grabs the mouse and confines it to the window. love.mouse.setGrabbed( grab ) grab boolean True to confine the mouse, false to let it leave the window.
love2d-community.github.io/love-api
love.mouse.setPosition
love.mouse.setPosition Sets the current position of the mouse. Non-integer values are floored. love.mouse.setPosition( x, y ) x number The new position of the mouse along the x-axis. y number The new position of the mouse along the y-axis.
love2d-community.github.io/love-api
love.mouse.setRelativeMode
love.mouse.setRelativeMode Sets whether relative mode is enabled for the mouse. When relative mode is enabled, the cursor is hidden and doesn't move when the mouse does, but relative mouse motion events are still generated via love.mousemoved. This lets the mouse move in any direction indefinitely without the cursor getting stuck at the edges of the screen. The reported position of the mouse may not be updated while relative mode is enabled, even when relative mouse motion events are generated. love.mouse.setRelativeMode( enable ) enable boolean True to enable relative mode, false to disable it.
love2d-community.github.io/love-api
love.mouse.setVisible
love.mouse.setVisible Sets the current visibility of the cursor. love.mouse.setVisible( visible ) visible boolean True to set the cursor to visible, false to hide the cursor.
love2d-community.github.io/love-api
love.mouse.setX
love.mouse.setX Sets the current X position of the mouse. Non-integer values are floored. love.mouse.setX( x ) x number The new position of the mouse along the x-axis.
love2d-community.github.io/love-api
love.mouse.setY
love.mouse.setY Sets the current Y position of the mouse. Non-integer values are floored. love.mouse.setY( y ) y number The new position of the mouse along the y-axis.
love2d-community.github.io/love-api
Cursor:getType
Cursor:getType Gets the type of the Cursor. ctype = Cursor:getType() ctype CursorType The type of the Cursor.
love2d-community.github.io/love-api
love.physics.getDistance
love.physics.getDistance Returns the two closest points between two fixtures and their distance. distance, x1, y1, x2, y2 = love.physics.getDistance( fixture1, fixture2 ) fixture1 Fixture The first fixture. fixture2 Fixture The second fixture. distance number The distance of the two points. x1 number The x-coordinate of the first point. y1 number The y-coordinate of the first point. x2 number The x-coordinate of the second point. y2 number The y-coordinate of the second point.
love2d-community.github.io/love-api
love.physics.getMeter
love.physics.getMeter Returns the meter scale factor. All coordinates in the physics module are divided by this number, creating a convenient way to draw the objects directly to the screen without the need for graphics transformations. It is recommended to create shapes no larger than 10 times the scale. This is important because Box2D is tuned to work well with shape sizes from 0.1 to 10 meters. scale = love.physics.getMeter() scale number The scale factor as an integer.
love2d-community.github.io/love-api
love.physics.newBody
love.physics.newBody Creates a new body. There are three types of bodies. * Static bodies do not move, have a infinite mass, and can be used for level boundaries. * Dynamic bodies are the main actors in the simulation, they collide with everything. * Kinematic bodies do not react to forces and only collide with dynamic bodies. The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData. body = love.physics.newBody( world, x, y, type ) world World The world to create the body in. x (0) number The x position of the body. y (0) number The y position of the body. type ('static') BodyType The type of the body. body Body A new body.
love2d-community.github.io/love-api
love.physics.newChainShape
love.physics.newChainShape Creates a new ChainShape. shape = love.physics.newChainShape( loop, x1, y1, x2, y2, ... ) loop boolean If the chain should loop back to the first point. x1 number The x position of the first point. y1 number The y position of the first point. x2 number The x position of the second point. y2 number The y position of the second point. ... number Additional point positions. shape ChainShape The new shape. shape = love.physics.newChainShape( loop, points ) loop boolean If the chain should loop back to the first point. points table A list of points to construct the ChainShape, in the form of {x1, y1, x2, y2, ...}. shape ChainShape The new shape.
love2d-community.github.io/love-api
love.physics.newCircleShape
love.physics.newCircleShape Creates a new CircleShape. shape = love.physics.newCircleShape( radius ) radius number The radius of the circle. shape CircleShape The new shape. shape = love.physics.newCircleShape( x, y, radius ) x number The x position of the circle. y number The y position of the circle. radius number The radius of the circle. shape CircleShape The new shape.
love2d-community.github.io/love-api
love.physics.newDistanceJoint
love.physics.newDistanceJoint Creates a DistanceJoint between two bodies. This joint constrains the distance between two points on two bodies to be constant. These two points are specified in world coordinates and the two bodies are assumed to be in place when this joint is created. The first anchor point is connected to the first body and the second to the second body, and the points define the length of the distance joint. joint = love.physics.newDistanceJoint( body1, body2, x1, y1, x2, y2, collideConnected ) body1 Body The first body to attach to the joint. body2 Body The second body to attach to the joint. x1 number The x position of the first anchor point (world space). y1 number The y position of the first anchor point (world space). x2 number The x position of the second anchor point (world space). y2 number The y position of the second anchor point (world space). collideConnected (false) boolean Specifies whether the two bodies should collide with each other. joint DistanceJoint The new distance joint.
love2d-community.github.io/love-api