main function
stringlengths
8
40
chunks
stringlengths
41
8.32k
repo_name
stringclasses
1 value
ParticleSystem:setSpinVariation
ParticleSystem:setSpinVariation Sets the amount of spin variation (0 meaning no variation and 1 meaning full variation between start and end). ParticleSystem:setSpinVariation( variation ) variation number The amount of variation (0 meaning no variation and 1 meaning full variation between start and end).
love2d-community.github.io/love-api
ParticleSystem:setSpread
ParticleSystem:setSpread Sets the amount of spread for the system. ParticleSystem:setSpread( spread ) spread number The amount of spread (radians).
love2d-community.github.io/love-api
ParticleSystem:setTangentialAcceleration
ParticleSystem:setTangentialAcceleration Sets the tangential acceleration (acceleration perpendicular to the particle's direction). ParticleSystem:setTangentialAcceleration( min, max ) min number The minimum acceleration. max (min) number The maximum acceleration.
love2d-community.github.io/love-api
ParticleSystem:setTexture
ParticleSystem:setTexture Sets the texture (Image or Canvas) to be used for the particles. ParticleSystem:setTexture( texture ) texture Texture An Image or Canvas to use for the particles.
love2d-community.github.io/love-api
ParticleSystem:start
ParticleSystem:start Starts the particle emitter. ParticleSystem:start()
love2d-community.github.io/love-api
ParticleSystem:stop
ParticleSystem:stop Stops the particle emitter, resetting the lifetime counter. ParticleSystem:stop()
love2d-community.github.io/love-api
ParticleSystem:update
ParticleSystem:update Updates the particle system; moving, creating and killing particles. ParticleSystem:update( dt ) dt number The time (seconds) since last frame.
love2d-community.github.io/love-api
Quad:getTextureDimensions
Quad:getTextureDimensions Gets reference texture dimensions initially specified in love.graphics.newQuad. sw, sh = Quad:getTextureDimensions() sw number The Texture width used by the Quad. sh number The Texture height used by the Quad.
love2d-community.github.io/love-api
Quad:getViewport
Quad:getViewport Gets the current viewport of this Quad. x, y, w, h = Quad:getViewport() x number The top-left corner along the x-axis. y number The top-left corner along the y-axis. w number The width of the viewport. h number The height of the viewport.
love2d-community.github.io/love-api
Quad:setViewport
Quad:setViewport Sets the texture coordinates according to a viewport. Quad:setViewport( x, y, w, h, sw, sh ) x number The top-left corner along the x-axis. y number The top-left corner along the y-axis. w number The width of the viewport. h number The height of the viewport. sw number The reference width, the width of the Image. (Must be greater than 0.) sh number The reference height, the height of the Image. (Must be greater than 0.)
love2d-community.github.io/love-api
Shader:getWarnings
Shader:getWarnings Returns any warning and error messages from compiling the shader code. This can be used for debugging your shaders if there's anything the graphics hardware doesn't like. warnings = Shader:getWarnings() warnings string Warning and error messages (if any).
love2d-community.github.io/love-api
Shader:hasUniform
Shader:hasUniform Gets whether a uniform / extern variable exists in the Shader. If a graphics driver's shader compiler determines that a uniform / extern variable doesn't affect the final output of the shader, it may optimize the variable out. This function will return false in that case. hasuniform = Shader:hasUniform( name ) name string The name of the uniform variable. hasuniform boolean Whether the uniform exists in the shader and affects its final output.
love2d-community.github.io/love-api
Shader:send
Shader:send Sends one or more values to a special (''uniform'') variable inside the shader. Uniform variables have to be marked using the ''uniform'' or ''extern'' keyword, e.g. uniform float time; // 'float' is the typical number type used in GLSL shaders. uniform float varsvec2 light_pos; uniform vec4 colors[4; The corresponding send calls would be shader:send('time', t) shader:send('vars',a,b) shader:send('light_pos', {light_x, light_y}) shader:send('colors', {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4}) Uniform / extern variables are read-only in the shader code and remain constant until modified by a Shader:send call. Uniform variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each. Shader:send( name, number, ... ) name string Name of the number to send to the shader. number number Number to send to store in the uniform variable. ... number Additional numbers to send if the uniform variable is an array. Shader:send( name, vector, ... ) name string Name of the vector to send to the shader. vector table Numbers to send to the uniform variable as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used. ... table Additional vectors to send if the uniform variable is an array. All vectors need to be of the same size (e.g. only vec3's). Shader:send( name, matrix, ... ) name string Name of the matrix to send to the shader. matrix table 2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: {{a,b,c,d}, {e,f,g,h}, ... } or (since version 0.10.2) {a,b,c,d, e,f,g,h, ...}. The order in 0.10.2 is column-major; starting in 11.0 it's row-major instead. ... table Additional matrices of the same type as ''matrix'' to store in a uniform array. Shader:send( name, texture ) name string Name of the Texture to send to the shader. texture Texture Texture (Image or Canvas) to send to the uniform variable. Shader:send( name, boolean, ... ) name string Name of the boolean to send to the shader. boolean boolean Boolean to send to store in the uniform variable. ... boolean Additional booleans to send if the uniform variable is an array. Shader:send( name, matrixlayout, matrix, ... ) name string Name of the matrix to send to the shader. matrixlayout MatrixLayout The layout (row- or column-major) of the matrix. matrix table 2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: {{a,b,c,d}, {e,f,g,h}, ... } or {a,b,c,d, e,f,g,h, ...}. ... table Additional matrices of the same type as ''matrix'' to store in a uniform array. Shader:send( name, data, offset, size ) name string Name of the uniform to send to the shader. data Data Data object containing the values to send. offset (0) number Offset in bytes from the start of the Data object. size (all) number Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied. Shader:send( name, data, matrixlayout, offset, size ) name string Name of the uniform matrix to send to the shader. data Data Data object containing the values to send. matrixlayout MatrixLayout The layout (row- or column-major) of the matrix in memory. offset (0) number Offset in bytes from the start of the Data object. size (all) number Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied. Shader:send( name, matrixlayout, data, offset, size ) name string Name of the uniform matrix to send to the shader. matrixlayout MatrixLayout The layout (row- or column-major) of the matrix in memory. data Data Data object containing the values to send. offset (0) number Offset in bytes from the start of the Data object. size (all) number Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied.
love2d-community.github.io/love-api
Shader:sendColor
Shader:sendColor Sends one or more colors to a special (''extern'' / ''uniform'') vec3 or vec4 variable inside the shader. The color components must be in the range of 1. The colors are gamma-corrected if global gamma-correction is enabled. Extern variables must be marked using the ''extern'' keyword, e.g. extern vec4 Color; The corresponding sendColor call would be shader:sendColor('Color', {r, g, b, a}) Extern variables can be accessed in both the Vertex and Pixel stages of a shader, as long as the variable is declared in each. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. Shader:sendColor( name, color, ... ) name string The name of the color extern variable to send to in the shader. color table A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector. ... table Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3's).
love2d-community.github.io/love-api
SpriteBatch:add
SpriteBatch:add Adds a sprite to the batch. Sprites are drawn in the order they are added. id = SpriteBatch:add( x, y, r, sx, sy, ox, oy, kx, ky ) x number The position to draw the object (x-axis). y number The position to draw the object (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shear factor (x-axis). ky (0) number Shear factor (y-axis). id number An identifier for the added sprite. id = SpriteBatch:add( quad, x, y, r, sx, sy, ox, oy, kx, ky ) quad Quad The Quad to add. x number The position to draw the object (x-axis). y number The position to draw the object (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shear factor (x-axis). ky (0) number Shear factor (y-axis). id number An identifier for the added sprite.
love2d-community.github.io/love-api
SpriteBatch:addLayer
SpriteBatch:addLayer Adds a sprite to a batch created with an Array Texture. spriteindex = SpriteBatch:addLayer( layerindex, x, y, r, sx, sy, ox, oy, kx, ky ) layerindex number The index of the layer to use for this sprite. x (0) number The position to draw the sprite (x-axis). y (0) number The position to draw the sprite (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). spriteindex number The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer. spriteindex = SpriteBatch:addLayer( layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky ) layerindex number The index of the layer to use for this sprite. quad Quad The subsection of the texture's layer to use when drawing the sprite. x (0) number The position to draw the sprite (x-axis). y (0) number The position to draw the sprite (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). spriteindex number The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer. spriteindex = SpriteBatch:addLayer( layerindex, transform ) layerindex number The index of the layer to use for this sprite. transform Transform A transform object. spriteindex number The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer. spriteindex = SpriteBatch:addLayer( layerindex, quad, transform ) layerindex number The index of the layer to use for this sprite. quad Quad The subsection of the texture's layer to use when drawing the sprite. transform Transform A transform object. spriteindex number The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer.
love2d-community.github.io/love-api
SpriteBatch:attachAttribute
SpriteBatch:attachAttribute Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors. Each sprite in a SpriteBatch has 4 vertices in the following order: top-left, bottom-left, top-right, bottom-right. The index returned by SpriteBatch:add (and used by SpriteBatch:set) can used to determine the first vertex of a specific sprite with the formula 1 + 4 * ( id - 1 ). SpriteBatch:attachAttribute( name, mesh ) name string The name of the vertex attribute to attach. mesh Mesh The Mesh to get the vertex attribute from.
love2d-community.github.io/love-api
SpriteBatch:clear
SpriteBatch:clear Removes all sprites from the buffer. SpriteBatch:clear()
love2d-community.github.io/love-api
SpriteBatch:flush
SpriteBatch:flush Immediately sends all new and modified sprite data in the batch to the graphics card. Normally it isn't necessary to call this method as love.graphics.draw(spritebatch, ...) will do it automatically if needed, but explicitly using SpriteBatch:flush gives more control over when the work happens. If this method is used, it generally shouldn't be called more than once (at most) between love.graphics.draw(spritebatch, ...) calls. SpriteBatch:flush()
love2d-community.github.io/love-api
SpriteBatch:getBufferSize
SpriteBatch:getBufferSize Gets the maximum number of sprites the SpriteBatch can hold. size = SpriteBatch:getBufferSize() size number The maximum number of sprites the batch can hold.
love2d-community.github.io/love-api
SpriteBatch:getColor
SpriteBatch:getColor Gets the color that will be used for the next add and set operations. If no color has been set with SpriteBatch:setColor or the current SpriteBatch color has been cleared, this method will return nil. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. r, g, b, a = SpriteBatch:getColor() r number The red component (0-1). g number The green component (0-1). b number The blue component (0-1). a number The alpha component (0-1).
love2d-community.github.io/love-api
SpriteBatch:getCount
SpriteBatch:getCount Gets the number of sprites currently in the SpriteBatch. count = SpriteBatch:getCount() count number The number of sprites currently in the batch.
love2d-community.github.io/love-api
SpriteBatch:getTexture
SpriteBatch:getTexture Gets the texture (Image or Canvas) used by the SpriteBatch. texture = SpriteBatch:getTexture() texture Texture The Image or Canvas used by the SpriteBatch.
love2d-community.github.io/love-api
SpriteBatch:set
SpriteBatch:set Changes a sprite in the batch. This requires the sprite index returned by SpriteBatch:add or SpriteBatch:addLayer. SpriteBatch:set( spriteindex, x, y, r, sx, sy, ox, oy, kx, ky ) spriteindex number The index of the sprite that will be changed. x number The position to draw the object (x-axis). y number The position to draw the object (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shear factor (x-axis). ky (0) number Shear factor (y-axis). SpriteBatch:set( spriteindex, quad, x, y, r, sx, sy, ox, oy, kx, ky ) spriteindex number The index of the sprite that will be changed. quad Quad The Quad used on the image of the batch. x number The position to draw the object (x-axis). y number The position to draw the object (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shear factor (x-axis). ky (0) number Shear factor (y-axis).
love2d-community.github.io/love-api
SpriteBatch:setColor
SpriteBatch:setColor Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. In version 0.9.2 and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color. SpriteBatch:setColor( r, g, b, a ) r number The amount of red. g number The amount of green. b number The amount of blue. a (1) number The amount of alpha. SpriteBatch:setColor()
love2d-community.github.io/love-api
SpriteBatch:setDrawRange
SpriteBatch:setDrawRange Restricts the drawn sprites in the SpriteBatch to a subset of the total. SpriteBatch:setDrawRange( start, count ) start number The index of the first sprite to draw. Index 1 corresponds to the first sprite added with SpriteBatch:add. count number The number of sprites to draw. SpriteBatch:setDrawRange()
love2d-community.github.io/love-api
SpriteBatch:setLayer
SpriteBatch:setLayer Changes a sprite previously added with add or addLayer, in a batch created with an Array Texture. SpriteBatch:setLayer( spriteindex, layerindex, x, y, r, sx, sy, ox, oy, kx, ky ) spriteindex number The index of the existing sprite to replace. layerindex number The index of the layer in the Array Texture to use for this sprite. x (0) number The position to draw the sprite (x-axis). y (0) number The position to draw the sprite (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). SpriteBatch:setLayer( spriteindex, layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky ) spriteindex number The index of the existing sprite to replace. layerindex number The index of the layer to use for this sprite. quad Quad The subsection of the texture's layer to use when drawing the sprite. x (0) number The position to draw the sprite (x-axis). y (0) number The position to draw the sprite (y-axis). r (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). SpriteBatch:setLayer( spriteindex, layerindex, transform ) spriteindex number The index of the existing sprite to replace. layerindex number The index of the layer to use for the sprite. transform Transform A transform object. SpriteBatch:setLayer( spriteindex, layerindex, quad, transform ) spriteindex number The index of the existing sprite to replace. layerindex number The index of the layer to use for the sprite. quad Quad The subsection of the texture's layer to use when drawing the sprite. transform Transform A transform object.
love2d-community.github.io/love-api
SpriteBatch:setTexture
SpriteBatch:setTexture Sets the texture (Image or Canvas) used for the sprites in the batch, when drawing. SpriteBatch:setTexture( texture ) texture Texture The new Image or Canvas to use for the sprites in the batch.
love2d-community.github.io/love-api
Text:add
Text:add Adds additional colored text to the Text object at the specified position. index = Text:add( textstring, x, y, angle, sx, sy, ox, oy, kx, ky ) textstring string The text to add to the object. x (0) number The position of the new text on the x-axis. y (0) number The position of the new text on the y-axis. angle (0) number The orientation of the new text 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. index number An index number that can be used with Text:getWidth or Text:getHeight. index = Text:add( coloredtext, x, y, angle, sx, sy, ox, oy, kx, ky ) coloredtext table A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}. coloredtext.color1 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string1 string A string of text which has a color specified by the previous color. coloredtext.color2 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string2 string A string of text which has a color specified by the previous color. coloredtext.... tables and strings Additional colors and strings. x (0) number The position of the new text on the x-axis. y (0) number The position of the new text on the y-axis. angle (0) number The orientation of the new text 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. index number An index number that can be used with Text:getWidth or Text:getHeight.
love2d-community.github.io/love-api
Text:addf
Text:addf Adds additional formatted / colored text to the Text object at the specified position. The word wrap limit is applied before any scaling, rotation, and other coordinate transformations. Therefore the amount of text per line stays constant given the same wrap limit, even if the scale arguments change. index = Text:addf( textstring, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky ) textstring string The text to add to the object. wraplimit number The maximum width in pixels of the text before it gets automatically wrapped to a new line. align AlignMode The alignment of the text. x number The position of the new text (x-axis). y number The position of the new text (y-axis). angle (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing / skew factor (x-axis). ky (0) number Shearing / skew factor (y-axis). index number An index number that can be used with Text:getWidth or Text:getHeight. index = Text:addf( coloredtext, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky ) coloredtext table A table containing colors and strings to add to the object, in the form of {color1, string1, color2, string2, ...}. coloredtext.color1 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string1 string A string of text which has a color specified by the previous color. coloredtext.color2 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string2 string A string of text which has a color specified by the previous color. coloredtext.... tables and strings Additional colors and strings. wraplimit number The maximum width in pixels of the text before it gets automatically wrapped to a new line. align AlignMode The alignment of the text. x number The position of the new text (x-axis). y number The position of the new text (y-axis). angle (0) number Orientation (radians). sx (1) number Scale factor (x-axis). sy (sx) number Scale factor (y-axis). ox (0) number Origin offset (x-axis). oy (0) number Origin offset (y-axis). kx (0) number Shearing / skew factor (x-axis). ky (0) number Shearing / skew factor (y-axis). index number An index number that can be used with Text:getWidth or Text:getHeight.
love2d-community.github.io/love-api
Text:clear
Text:clear Clears the contents of the Text object. Text:clear()
love2d-community.github.io/love-api
Text:getDimensions
Text:getDimensions Gets the width and height of the text in pixels. width, height = Text:getDimensions() width number The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned. height number The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned. width, height = Text:getDimensions( index ) index number An index number returned by Text:add or Text:addf. width number The width of the sub-string (before scaling and other transformations). height number The height of the sub-string (before scaling and other transformations).
love2d-community.github.io/love-api
Text:getFont
Text:getFont Gets the Font used with the Text object. font = Text:getFont() font Font The font used with this Text object.
love2d-community.github.io/love-api
Text:getHeight
Text:getHeight Gets the height of the text in pixels. height = Text:getHeight() height number The height of the text. If multiple sub-strings have been added with Text:add, the height of the last sub-string is returned. height = Text:getHeight( index ) index number An index number returned by Text:add or Text:addf. height number The height of the sub-string (before scaling and other transformations).
love2d-community.github.io/love-api
Text:getWidth
Text:getWidth Gets the width of the text in pixels. width = Text:getWidth() width number The width of the text. If multiple sub-strings have been added with Text:add, the width of the last sub-string is returned. width = Text:getWidth( index ) index number An index number returned by Text:add or Text:addf. width number The width of the sub-string (before scaling and other transformations).
love2d-community.github.io/love-api
Text:set
Text:set Replaces the contents of the Text object with a new unformatted string. Text:set( textstring ) textstring string The new string of text to use. Text:set( coloredtext ) coloredtext table A table containing colors and strings to use as the new text, in the form of {color1, string1, color2, string2, ...}. coloredtext.color1 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string1 string A string of text which has a color specified by the previous color. coloredtext.color2 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string2 string A string of text which has a color specified by the previous color. coloredtext.... tables and strings Additional colors and strings.
love2d-community.github.io/love-api
Text:setFont
Text:setFont Replaces the Font used with the text. Text:setFont( font ) font Font The new font to use with this Text object.
love2d-community.github.io/love-api
Text:setf
Text:setf Replaces the contents of the Text object with a new formatted string. Text:setf( textstring, wraplimit, align ) textstring string The new string of text to use. wraplimit number The maximum width in pixels of the text before it gets automatically wrapped to a new line. align AlignMode The alignment of the text. Text:setf( coloredtext, wraplimit, align ) coloredtext table A table containing colors and strings to use as the new text, in the form of {color1, string1, color2, string2, ...}. coloredtext.color1 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string1 string A string of text which has a color specified by the previous color. coloredtext.color2 table A table containing red, green, blue, and optional alpha components to use as a color for the next string in the table, in the form of {red, green, blue, alpha}. coloredtext.string2 string A string of text which has a color specified by the previous color. coloredtext.... tables and strings Additional colors and strings. wraplimit number The maximum width in pixels of the text before it gets automatically wrapped to a new line. align AlignMode The alignment of the text.
love2d-community.github.io/love-api
Texture:getDPIScale
Texture:getDPIScale Gets the DPI scale factor of the Texture. The DPI scale factor represents relative pixel density. A DPI scale factor of 2 means the texture has twice the pixel density in each dimension (4 times as many pixels in the same area) compared to a texture with a DPI scale factor of 1. For example, a texture with pixel dimensions of 100x100 with a DPI scale factor of 2 will be drawn as if it was 50x50. This is useful with high-dpi / retina displays to easily allow swapping out higher or lower pixel density Images and Canvases without needing any extra manual scaling logic. dpiscale = Texture:getDPIScale() dpiscale number The DPI scale factor of the Texture.
love2d-community.github.io/love-api
Texture:getDepth
Texture:getDepth Gets the depth of a Volume Texture. Returns 1 for 2D, Cubemap, and Array textures. depth = Texture:getDepth() depth number The depth of the volume Texture.
love2d-community.github.io/love-api
Texture:getDepthSampleMode
Texture:getDepthSampleMode Gets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. compare = Texture:getDepthSampleMode() compare (nil) CompareMode The comparison mode used when sampling from this texture in a shader, or nil if setDepthSampleMode has not been called on this Texture.
love2d-community.github.io/love-api
Texture:getDimensions
Texture:getDimensions Gets the width and height of the Texture. width, height = Texture:getDimensions() width number The width of the Texture. height number The height of the Texture.
love2d-community.github.io/love-api
Texture:getFilter
Texture:getFilter Gets the filter mode of the Texture. min, mag, anisotropy = Texture:getFilter() min FilterMode Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels). mag FilterMode Filter mode to use when magnifying the texture (rendering it at a smaller size on-screen than its size in pixels). anisotropy number Maximum amount of anisotropic filtering used.
love2d-community.github.io/love-api
Texture:getFormat
Texture:getFormat Gets the pixel format of the Texture. format = Texture:getFormat() format PixelFormat The pixel format the Texture was created with.
love2d-community.github.io/love-api
Texture:getHeight
Texture:getHeight Gets the height of the Texture. height = Texture:getHeight() height number The height of the Texture.
love2d-community.github.io/love-api
Texture:getLayerCount
Texture:getLayerCount Gets the number of layers / slices in an Array Texture. Returns 1 for 2D, Cubemap, and Volume textures. layers = Texture:getLayerCount() layers number The number of layers in the Array Texture.
love2d-community.github.io/love-api
Texture:getMipmapCount
Texture:getMipmapCount Gets the number of mipmaps contained in the Texture. If the texture was not created with mipmaps, it will return 1. mipmaps = Texture:getMipmapCount() mipmaps number The number of mipmaps in the Texture.
love2d-community.github.io/love-api
Texture:getMipmapFilter
Texture:getMipmapFilter Gets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. mode, sharpness = Texture:getMipmapFilter() mode FilterMode The filter mode used in between mipmap levels. nil if mipmap filtering is not enabled. sharpness number Value used to determine whether the image should use more or less detailed mipmap levels than normal when drawing.
love2d-community.github.io/love-api
Texture:getPixelDimensions
Texture:getPixelDimensions Gets the width and height in pixels of the Texture. Texture:getDimensions gets the dimensions of the texture in units scaled by the texture's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelDimensions only when dealing specifically with pixels, for example when using Canvas:newImageData. pixelwidth, pixelheight = Texture:getPixelDimensions() pixelwidth number The width of the Texture, in pixels. pixelheight number The height of the Texture, in pixels.
love2d-community.github.io/love-api
Texture:getPixelHeight
Texture:getPixelHeight Gets the height in pixels of the Texture. DPI scale factor, rather than pixels. Use getHeight for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelHeight only when dealing specifically with pixels, for example when using Canvas:newImageData. pixelheight = Texture:getPixelHeight() pixelheight number The height of the Texture, in pixels.
love2d-community.github.io/love-api
Texture:getPixelWidth
Texture:getPixelWidth Gets the width in pixels of the Texture. DPI scale factor, rather than pixels. Use getWidth for calculations related to drawing the texture (calculating an origin offset, for example), and getPixelWidth only when dealing specifically with pixels, for example when using Canvas:newImageData. pixelwidth = Texture:getPixelWidth() pixelwidth number The width of the Texture, in pixels.
love2d-community.github.io/love-api
Texture:getTextureType
Texture:getTextureType Gets the type of the Texture. texturetype = Texture:getTextureType() texturetype TextureType The type of the Texture.
love2d-community.github.io/love-api
Texture:getWidth
Texture:getWidth Gets the width of the Texture. width = Texture:getWidth() width number The width of the Texture.
love2d-community.github.io/love-api
Texture:getWrap
Texture:getWrap Gets the wrapping properties of a Texture. This function returns the currently set horizontal and vertical wrapping modes for the texture. horiz, vert, depth = Texture:getWrap() horiz WrapMode Horizontal wrapping mode of the texture. vert WrapMode Vertical wrapping mode of the texture. depth WrapMode Wrapping mode for the z-axis of a Volume texture.
love2d-community.github.io/love-api
Texture:isReadable
Texture:isReadable Gets whether the Texture can be drawn and sent to a Shader. Canvases created with stencil and/or depth PixelFormats are not readable by default, unless readable=true is specified in the settings table passed into love.graphics.newCanvas. Non-readable Canvases can still be rendered to. readable = Texture:isReadable() readable boolean Whether the Texture is readable.
love2d-community.github.io/love-api
Texture:setDepthSampleMode
Texture:setDepthSampleMode Sets the comparison mode used when sampling from a depth texture in a shader. Depth texture comparison modes are advanced low-level functionality typically used with shadow mapping in 3D. When using a depth texture with a comparison mode set in a shader, it must be declared as a sampler2DShadow and used in a GLSL 3 Shader. The result of accessing the texture in the shader will return a float between 0 and 1, proportional to the number of samples (up to 4 samples will be used if bilinear filtering is enabled) that passed the test set by the comparison operation. Depth texture comparison can only be used with readable depth-formatted Canvases. Texture:setDepthSampleMode( compare ) compare CompareMode The comparison mode used when sampling from this texture in a shader.
love2d-community.github.io/love-api
Texture:setFilter
Texture:setFilter Sets the filter mode of the Texture. Texture:setFilter( min, mag, anisotropy ) min FilterMode Filter mode to use when minifying the texture (rendering it at a smaller size on-screen than its size in pixels). mag (min) FilterMode Filter mode to use when magnifying the texture (rendering it at a larger size on-screen than its size in pixels). anisotropy (1) number Maximum amount of anisotropic filtering to use.
love2d-community.github.io/love-api
Texture:setMipmapFilter
Texture:setMipmapFilter Sets the mipmap filter mode for a Texture. Prior to 11.0 this method only worked on Images. Mipmapping is useful when drawing a texture at a reduced scale. It can improve performance and reduce aliasing issues. In created with the mipmaps flag enabled for the mipmap filter to have any effect. In versions prior to 0.10.0 it's best to call this method directly after creating the image with love.graphics.newImage, to avoid bugs in certain graphics drivers. Due to hardware restrictions and driver bugs, in versions prior to 0.10.0 images that weren't loaded from a CompressedData must have power-of-two dimensions (64x64, 512x256, etc.) to use mipmaps. Texture:setMipmapFilter( filtermode, sharpness ) filtermode FilterMode The filter mode to use in between mipmap levels. 'nearest' will often give better performance. sharpness (0) number A positive sharpness value makes the texture use a more detailed mipmap level when drawing, at the expense of performance. A negative value does the reverse. Texture:setMipmapFilter()
love2d-community.github.io/love-api
Texture:setWrap
Texture:setWrap Sets the wrapping properties of a Texture. This function sets the way a Texture is repeated when it is drawn with a Quad that is larger than the texture's extent, or when a custom Shader is used which uses texture coordinates outside of [0, 1]. A texture may be clamped or set to repeat in both horizontal and vertical directions. Clamped textures appear only once (with the edges of the texture stretching to fill the extent of the Quad), whereas repeated ones repeat as many times as there is room in the Quad. Texture:setWrap( horiz, vert, depth ) horiz WrapMode Horizontal wrapping mode of the texture. vert (horiz) WrapMode Vertical wrapping mode of the texture. depth (horiz) WrapMode Wrapping mode for the z-axis of a Volume texture.
love2d-community.github.io/love-api
Video:getDimensions
Video:getDimensions Gets the width and height of the Video in pixels. width, height = Video:getDimensions() width number The width of the Video. height number The height of the Video.
love2d-community.github.io/love-api
Video:getFilter
Video:getFilter Gets the scaling filters used when drawing the Video. min, mag, anisotropy = Video:getFilter() min FilterMode The filter mode used when scaling the Video down. mag FilterMode The filter mode used when scaling the Video up. anisotropy number Maximum amount of anisotropic filtering used.
love2d-community.github.io/love-api
Video:getHeight
Video:getHeight Gets the height of the Video in pixels. height = Video:getHeight() height number The height of the Video.
love2d-community.github.io/love-api
Video:getSource
Video:getSource Gets the audio Source used for playing back the video's audio. May return nil if the video has no audio, or if Video:setSource is called with a nil argument. source = Video:getSource() source Source The audio Source used for audio playback, or nil if the video has no audio.
love2d-community.github.io/love-api
Video:getStream
Video:getStream Gets the VideoStream object used for decoding and controlling the video. stream = Video:getStream() stream VideoStream The VideoStream used for decoding and controlling the video.
love2d-community.github.io/love-api
Video:getWidth
Video:getWidth Gets the width of the Video in pixels. width = Video:getWidth() width number The width of the Video.
love2d-community.github.io/love-api
Video:isPlaying
Video:isPlaying Gets whether the Video is currently playing. playing = Video:isPlaying() playing boolean Whether the video is playing.
love2d-community.github.io/love-api
Video:pause
Video:pause Pauses the Video. Video:pause()
love2d-community.github.io/love-api
Video:play
Video:play Starts playing the Video. In order for the video to appear onscreen it must be drawn with love.graphics.draw. Video:play()
love2d-community.github.io/love-api
Video:rewind
Video:rewind Rewinds the Video to the beginning. Video:rewind()
love2d-community.github.io/love-api
Video:seek
Video:seek Sets the current playback position of the Video. Video:seek( offset ) offset number The time in seconds since the beginning of the Video.
love2d-community.github.io/love-api
Video:setFilter
Video:setFilter Sets the scaling filters used when drawing the Video. Video:setFilter( min, mag, anisotropy ) min FilterMode The filter mode used when scaling the Video down. mag FilterMode The filter mode used when scaling the Video up. anisotropy (1) number Maximum amount of anisotropic filtering used.
love2d-community.github.io/love-api
Video:setSource
Video:setSource Sets the audio Source used for playing back the video's audio. The audio Source also controls playback speed and synchronization. Video:setSource( source ) source (nil) Source The audio Source used for audio playback, or nil to disable audio synchronization.
love2d-community.github.io/love-api
Video:tell
Video:tell Gets the current playback position of the Video. seconds = Video:tell() seconds number The time in seconds since the beginning of the Video.
love2d-community.github.io/love-api
love.image.isCompressed
love.image.isCompressed Determines whether a file can be loaded as CompressedImageData. compressed = love.image.isCompressed( filename ) filename string The filename of the potentially compressed image file. compressed boolean Whether the file can be loaded as CompressedImageData or not. compressed = love.image.isCompressed( fileData ) fileData FileData A FileData potentially containing a compressed image. compressed boolean Whether the FileData can be loaded as CompressedImageData or not.
love2d-community.github.io/love-api
love.image.newCompressedData
love.image.newCompressedData Create a new CompressedImageData object from a compressed image file. LÖVE supports several compressed texture formats, enumerated in the CompressedImageFormat page. compressedImageData = love.image.newCompressedData( filename ) filename string The filename of the compressed image file. compressedImageData CompressedImageData The new CompressedImageData object. compressedImageData = love.image.newCompressedData( fileData ) fileData FileData A FileData containing a compressed image. compressedImageData CompressedImageData The new CompressedImageData object.
love2d-community.github.io/love-api
love.image.newImageData
love.image.newImageData Creates a new ImageData object. imageData = love.image.newImageData( width, height ) width number The width of the ImageData. height number The height of the ImageData. imageData ImageData The new blank ImageData object. Each pixel's color values, (including the alpha values!) will be set to zero. imageData = love.image.newImageData( width, height, format, data ) width number The width of the ImageData. height number The height of the ImageData. format ('rgba8') PixelFormat The pixel format of the ImageData. data (nil) string Optional raw byte data to load into the ImageData, in the format specified by ''format''. imageData ImageData The new ImageData object. imageData = love.image.newImageData( width, height, data ) width number The width of the ImageData. height number The height of the ImageData. data string The data to load into the ImageData (RGBA bytes, left to right and top to bottom). imageData ImageData The new ImageData object. imageData = love.image.newImageData( filename ) filename string The filename of the image file. imageData ImageData The new ImageData object. imageData = love.image.newImageData( filedata ) filedata FileData The encoded file data to decode into image data. imageData ImageData The new ImageData object.
love2d-community.github.io/love-api
CompressedImageData:getDimensions
CompressedImageData:getDimensions Gets the width and height of the CompressedImageData. width, height = CompressedImageData:getDimensions() width number The width of the CompressedImageData. height number The height of the CompressedImageData. width, height = CompressedImageData:getDimensions( level ) level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount(). width number The width of a specific mipmap level of the CompressedImageData. height number The height of a specific mipmap level of the CompressedImageData.
love2d-community.github.io/love-api
CompressedImageData:getFormat
CompressedImageData:getFormat Gets the format of the CompressedImageData. format = CompressedImageData:getFormat() format CompressedImageFormat The format of the CompressedImageData.
love2d-community.github.io/love-api
CompressedImageData:getHeight
CompressedImageData:getHeight Gets the height of the CompressedImageData. height = CompressedImageData:getHeight() height number The height of the CompressedImageData. height = CompressedImageData:getHeight( level ) level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount(). height number The height of a specific mipmap level of the CompressedImageData.
love2d-community.github.io/love-api
CompressedImageData:getMipmapCount
CompressedImageData:getMipmapCount Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count. mipmaps = CompressedImageData:getMipmapCount() mipmaps number The number of mipmap levels stored in the CompressedImageData.
love2d-community.github.io/love-api
CompressedImageData:getWidth
CompressedImageData:getWidth Gets the width of the CompressedImageData. width = CompressedImageData:getWidth() width number The width of the CompressedImageData. width = CompressedImageData:getWidth( level ) level number A mipmap level. Must be in the range of CompressedImageData:getMipmapCount(). width number The width of a specific mipmap level of the CompressedImageData.
love2d-community.github.io/love-api
ImageData:encode
ImageData:encode Encodes the ImageData and optionally writes it to the save directory. filedata = ImageData:encode( format, filename ) format ImageFormat The format to encode the image as. filename (nil) string The filename to write the file to. If nil, no file will be written but the FileData will still be returned. filedata FileData The encoded image as a new FileData object. ImageData:encode( outFile ) outFile string Name of a file to write encoded data to. The format will be automatically deduced from the file extension. ImageData:encode( outFile, format ) outFile string Name of a file to write encoded data to. format ImageFormat The format to encode the image in.
love2d-community.github.io/love-api
ImageData:getDimensions
ImageData:getDimensions Gets the width and height of the ImageData in pixels. width, height = ImageData:getDimensions() width number The width of the ImageData in pixels. height number The height of the ImageData in pixels.
love2d-community.github.io/love-api
ImageData:getHeight
ImageData:getHeight Gets the height of the ImageData in pixels. height = ImageData:getHeight() height number The height of the ImageData in pixels.
love2d-community.github.io/love-api
ImageData:getPixel
ImageData:getPixel Gets the color of a pixel at a specific position in the image. Valid x and y values start at 0 and go up to image width and height minus 1. Non-integer values are floored. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. r, g, b, a = ImageData:getPixel( x, y ) x number The position of the pixel on the x-axis. y number The position of the pixel on the y-axis. r number The red component (0-1). g number The green component (0-1). b number The blue component (0-1). a number The alpha component (0-1).
love2d-community.github.io/love-api
ImageData:getWidth
ImageData:getWidth Gets the width of the ImageData in pixels. width = ImageData:getWidth() width number The width of the ImageData in pixels.
love2d-community.github.io/love-api
ImageData:mapPixel
ImageData:mapPixel Transform an image by applying a function to every pixel. This function is a higher-order function. It takes another function as a parameter, and calls it once for each pixel in the ImageData. The passed function is called with six parameters for each pixel in turn. The parameters are numbers that represent the x and y coordinates of the pixel and its red, green, blue and alpha values. The function should return the new red, green, blue, and alpha values for that pixel. function pixelFunction(x, y, r, g, b, a) -- template for defining your own pixel mapping function -- perform computations giving the new values for r, g, b and a -- ... return r, g, b, a end In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ImageData:mapPixel( pixelFunction, x, y, width, height ) pixelFunction function Function to apply to every pixel. x (0) number The x-axis of the top-left corner of the area within the ImageData to apply the function to. y (0) number The y-axis of the top-left corner of the area within the ImageData to apply the function to. width (ImageData:getWidth()) number The width of the area within the ImageData to apply the function to. height (ImageData:getHeight()) number The height of the area within the ImageData to apply the function to.
love2d-community.github.io/love-api
ImageData:paste
ImageData:paste Paste into ImageData from another source ImageData. ImageData:paste( source, dx, dy, sx, sy, sw, sh ) source ImageData Source ImageData from which to copy. dx number Destination top-left position on x-axis. dy number Destination top-left position on y-axis. sx number Source top-left position on x-axis. sy number Source top-left position on y-axis. sw number Source width. sh number Source height.
love2d-community.github.io/love-api
ImageData:setPixel
ImageData:setPixel Sets the color of a pixel at a specific position in the image. Valid x and y values start at 0 and go up to image width and height minus 1. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. ImageData:setPixel( x, y, r, g, b, a ) x number The position of the pixel on the x-axis. y number The position of the pixel on the y-axis. r number The red component (0-1). g number The green component (0-1). b number The blue component (0-1). a number The alpha component (0-1). ImageData:setPixel( x, y, color ) x number The position of the pixel on the x-axis. y number The position of the pixel on the y-axis. color table A numerical indexed table with the red, green, blue and alpha values as numbers.
love2d-community.github.io/love-api
ImageData:getFormat
ImageData:getFormat Gets the pixel format of the ImageData. format = ImageData:getFormat() format PixelFormat The pixel format the ImageData was created with.
love2d-community.github.io/love-api
love.joystick.getGamepadMappingString
love.joystick.getGamepadMappingString Gets the full gamepad mapping string of the Joysticks which have the given GUID, or nil if the GUID isn't 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 = love.joystick.getGamepadMappingString( guid ) guid string The GUID value to get the mapping string for. mappingstring string A string containing the Joystick's gamepad mappings, or nil if the GUID is not recognized as a gamepad.
love2d-community.github.io/love-api
love.joystick.getJoystickCount
love.joystick.getJoystickCount Gets the number of connected joysticks. joystickcount = love.joystick.getJoystickCount() joystickcount number The number of connected joysticks.
love2d-community.github.io/love-api
love.joystick.getJoysticks
love.joystick.getJoysticks Gets a list of connected Joysticks. joysticks = love.joystick.getJoysticks() joysticks table The list of currently connected Joysticks.
love2d-community.github.io/love-api
love.joystick.loadGamepadMappings
love.joystick.loadGamepadMappings Loads a gamepad mappings string or file created with love.joystick.saveGamepadMappings. It also recognizes any SDL gamecontroller mapping string, such as those created with Steam's Big Picture controller configure interface, or this nice database. If a new mapping is loaded for an already known controller GUID, the later version will overwrite the one currently loaded. love.joystick.loadGamepadMappings( filename ) filename string The filename to load the mappings string from. love.joystick.loadGamepadMappings( mappings ) mappings string The mappings string to load.
love2d-community.github.io/love-api
love.joystick.saveGamepadMappings
love.joystick.saveGamepadMappings Saves the virtual gamepad mappings of all recognized as gamepads and have either been recently used or their gamepad bindings have been modified. The mappings are stored as a string for use with love.joystick.loadGamepadMappings. mappings = love.joystick.saveGamepadMappings( filename ) filename string The filename to save the mappings string to. mappings string The mappings string that was written to the file. mappings = love.joystick.saveGamepadMappings() mappings string The mappings string.
love2d-community.github.io/love-api
love.joystick.setGamepadMapping
love.joystick.setGamepadMapping Binds a virtual gamepad input to a button, axis or hat for all Joysticks of a certain type. For example, if this function is used with a GUID returned by a Dualshock 3 controller in OS X, the binding will affect Joystick:getGamepadAxis and Joystick:isGamepadDown for ''all'' Dualshock 3 controllers used with the game when run in OS X. LÖVE includes built-in gamepad bindings for many common controllers. This function lets you change the bindings or add new ones for types of Joysticks which aren't recognized as gamepads by default. The virtual gamepad buttons and axes are designed around the Xbox 360 controller layout. success = love.joystick.setGamepadMapping( guid, button, inputtype, inputindex, hatdir ) guid string The OS-dependent GUID for the type of Joystick the binding will affect. button GamepadButton The virtual gamepad button to bind. inputtype JoystickInputType The type of input to bind the virtual gamepad button to. inputindex number The index of the axis, button, or hat to bind the virtual gamepad button to. hatdir (nil) JoystickHat The direction of the hat, if the virtual gamepad button will be bound to a hat. nil otherwise. success boolean Whether the virtual gamepad button was successfully bound. success = love.joystick.setGamepadMapping( guid, axis, inputtype, inputindex, hatdir ) guid string The OS-dependent GUID for the type of Joystick the binding will affect. axis GamepadAxis The virtual gamepad axis to bind. inputtype JoystickInputType The type of input to bind the virtual gamepad axis to. inputindex number The index of the axis, button, or hat to bind the virtual gamepad axis to. hatdir (nil) JoystickHat The direction of the hat, if the virtual gamepad axis will be bound to a hat. nil otherwise. success boolean Whether the virtual gamepad axis was successfully bound.
love2d-community.github.io/love-api
Joystick:getAxes
Joystick:getAxes Gets the direction of each axis. axisDir1, axisDir2, axisDirN = Joystick:getAxes() axisDir1 number Direction of axis1. axisDir2 number Direction of axis2. axisDirN number Direction of axisN.
love2d-community.github.io/love-api
Joystick:getAxis
Joystick:getAxis Gets the direction of an axis. direction = Joystick:getAxis( axis ) axis number The index of the axis to be checked. direction number Current value of the axis.
love2d-community.github.io/love-api
Joystick:getAxisCount
Joystick:getAxisCount Gets the number of axes on the joystick. axes = Joystick:getAxisCount() axes number The number of axes available.
love2d-community.github.io/love-api
Joystick:getButtonCount
Joystick:getButtonCount Gets the number of buttons on the joystick. buttons = Joystick:getButtonCount() buttons number The number of buttons available.
love2d-community.github.io/love-api