main function
stringlengths
8
40
chunks
stringlengths
41
8.32k
repo_name
stringclasses
1 value
Rasterizer:getGlyphCount
Rasterizer:getGlyphCount Gets number of glyphs in font. count = Rasterizer:getGlyphCount() count number Glyphs count.
love2d-community.github.io/love-api
Rasterizer:getGlyphData
Rasterizer:getGlyphData Gets glyph data of a specified glyph. glyphData = Rasterizer:getGlyphData( glyph ) glyph string Glyph glyphData GlyphData Glyph data glyphData = Rasterizer:getGlyphData( glyphNumber ) glyphNumber number Glyph number glyphData GlyphData Glyph data
love2d-community.github.io/love-api
Rasterizer:getHeight
Rasterizer:getHeight Gets font height. height = Rasterizer:getHeight() height number Font height
love2d-community.github.io/love-api
Rasterizer:getLineHeight
Rasterizer:getLineHeight Gets line height of a font. height = Rasterizer:getLineHeight() height number Line height of a font.
love2d-community.github.io/love-api
Rasterizer:hasGlyphs
Rasterizer:hasGlyphs Checks if font contains specified glyphs. hasGlyphs = Rasterizer:hasGlyphs( glyph1, glyph2, ... ) glyph1 string or number Glyph glyph2 string or number Glyph ... string or number Additional glyphs hasGlyphs boolean Whatever font contains specified glyphs.
love2d-community.github.io/love-api
love.graphics.applyTransform
love.graphics.applyTransform Applies the given Transform object to the current coordinate transformation. This effectively multiplies the existing coordinate transformation's matrix with the Transform object's internal matrix to produce the new coordinate transformation. love.graphics.applyTransform( transform ) transform Transform The Transform object to apply to the current graphics coordinate transform.
love2d-community.github.io/love-api
love.graphics.arc
love.graphics.arc Draws a filled or unfilled arc at position (x, y). The arc is drawn from angle1 to angle2 in radians. The segments parameter determines how many segments are used to draw the arc. The more segments, the smoother the edge. love.graphics.arc( drawmode, x, y, radius, angle1, angle2, segments ) drawmode DrawMode How to draw the arc. x number The position of the center along x-axis. y number The position of the center along y-axis. radius number Radius of the arc. angle1 number The angle at which the arc begins. angle2 number The angle at which the arc terminates. segments (10) number The number of segments used for drawing the arc. love.graphics.arc( drawmode, arctype, x, y, radius, angle1, angle2, segments ) drawmode DrawMode How to draw the arc. arctype ArcType The type of arc to draw. x number The position of the center along x-axis. y number The position of the center along y-axis. radius number Radius of the arc. angle1 number The angle at which the arc begins. angle2 number The angle at which the arc terminates. segments (10) number The number of segments used for drawing the arc.
love2d-community.github.io/love-api
love.graphics.captureScreenshot
love.graphics.captureScreenshot Creates a screenshot once the current frame is done (after love.draw has finished). Since this function enqueues a screenshot capture rather than executing it immediately, it can be called from an input callback or love.update and it will still capture all of what's drawn to the screen in that frame. love.graphics.captureScreenshot( filename ) filename string The filename to save the screenshot to. The encoded image type is determined based on the extension of the filename, and must be one of the ImageFormats. love.graphics.captureScreenshot( callback ) callback function Function which gets called once the screenshot has been captured. An ImageData is passed into the function as its only argument. love.graphics.captureScreenshot( channel ) channel Channel The Channel to push the generated ImageData to.
love2d-community.github.io/love-api
love.graphics.circle
love.graphics.circle Draws a circle. love.graphics.circle( mode, x, y, radius ) mode DrawMode How to draw the circle. x number The position of the center along x-axis. y number The position of the center along y-axis. radius number The radius of the circle. love.graphics.circle( mode, x, y, radius, segments ) mode DrawMode How to draw the circle. x number The position of the center along x-axis. y number The position of the center along y-axis. radius number The radius of the circle. segments number The number of segments used for drawing the circle. Note: The default variable for the segments parameter varies between different versions of LÖVE.
love2d-community.github.io/love-api
love.graphics.clear
love.graphics.clear Clears the screen or active Canvas to the specified color. This function is called automatically before love.draw in the default love.run function. See the example in love.run for a typical use of this function. Note that the scissor area bounds the cleared region. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. In versions prior to background color instead. love.graphics.clear() love.graphics.clear( r, g, b, a, clearstencil, cleardepth ) r number The red channel of the color to clear the screen to. g number The green channel of the color to clear the screen to. b number The blue channel of the color to clear the screen to. a (1) number The alpha channel of the color to clear the screen to. clearstencil (true) boolean Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value. cleardepth (true) boolean Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value. love.graphics.clear( color, ..., clearstencil, cleardepth ) color table A table in the form of {r, g, b, a} containing the color to clear the first active Canvas to. ... table Additional tables for each active Canvas. clearstencil (true) boolean Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value. cleardepth (true) boolean Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value. love.graphics.clear( clearcolor, clearstencil, cleardepth ) clearcolor boolean Whether to clear the active color canvas to transparent black (0, 0, 0, 0). Typically this should be set to false with this variant of the function. clearstencil boolean Whether to clear the active stencil buffer, if present. It can also be an integer between 0 and 255 to clear the stencil buffer to a specific value. cleardepth boolean Whether to clear the active depth buffer, if present. It can also be a number between 0 and 1 to clear the depth buffer to a specific value.
love2d-community.github.io/love-api
love.graphics.discard
love.graphics.discard Discards (trashes) the contents of the screen or active Canvas. This is a performance optimization function with niche use cases. If the active Canvas has just been changed and the 'replace' BlendMode is about to be used to draw something which covers the entire screen, calling love.graphics.discard rather than calling love.graphics.clear or doing nothing may improve performance on mobile devices. On some desktop systems this function may do nothing. love.graphics.discard( discardcolor, discardstencil ) discardcolor (true) boolean Whether to discard the texture(s) of the active Canvas(es) (the contents of the screen if no Canvas is active.) discardstencil (true) boolean Whether to discard the contents of the stencil buffer of the screen / active Canvas. love.graphics.discard( discardcolors, discardstencil ) discardcolors table An array containing boolean values indicating whether to discard the texture of each active Canvas, when multiple simultaneous Canvases are active. discardstencil (true) boolean Whether to discard the contents of the stencil buffer of the screen / active Canvas.
love2d-community.github.io/love-api
love.graphics.draw
love.graphics.draw Draws a Drawable object (an Image, Canvas, SpriteBatch, ParticleSystem, Mesh, Text object, or Video) on the screen with optional rotation, scaling and shearing. Objects are drawn relative to their local coordinate system. The origin is by default located at the top left corner of Image and Canvas. All scaling, shearing, and rotation arguments transform the object relative to that point. Also, the position of the origin can be specified on the screen coordinate system. It's possible to rotate an object about its center by offsetting the origin to the center. Angles must be given in radians for rotation. One can also use a negative scaling factor to flip about its centerline. Note that the offsets are applied before rotation, scaling, or shearing; scaling and shearing are applied before rotation. The right and bottom edges of the object are shifted at an angle defined by the shearing factors. When using the default shader anything drawn with this function will be tinted according to the currently selected color. Set it to pure white to preserve the object's original colors. love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy, kx, ky ) drawable Drawable A drawable object. x (0) number The position to draw the object (x-axis). y (0) 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 Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). love.graphics.draw( texture, quad, x, y, r, sx, sy, ox, oy, kx, ky ) texture Texture A Texture (Image or Canvas) to texture the Quad with. quad Quad The Quad to draw on screen. 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 Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). love.graphics.draw( drawable, transform ) drawable Drawable A drawable object. transform Transform Transformation object. love.graphics.draw( texture, quad, transform ) texture Texture A Texture (Image or Canvas) to texture the Quad with. quad Quad The Quad to draw on screen. transform Transform Transformation object.
love2d-community.github.io/love-api
love.graphics.drawInstanced
love.graphics.drawInstanced Draws many instances of a Mesh with a single draw call, using hardware geometry instancing. Each instance can have unique properties (positions, colors, etc.) but will not by default unless a custom per-instance vertex attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other. Instancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check. love.graphics.drawInstanced( mesh, instancecount, x, y, r, sx, sy, ox, oy, kx, ky ) mesh Mesh The mesh to render. instancecount number The number of instances to render. x (0) number The position to draw the instances (x-axis). y (0) number The position to draw the instances (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). love.graphics.drawInstanced( mesh, instancecount, transform ) mesh Mesh The mesh to render. instancecount number The number of instances to render. transform Transform A transform object.
love2d-community.github.io/love-api
love.graphics.drawLayer
love.graphics.drawLayer Draws a layer of an Array Texture. love.graphics.drawLayer( texture, layerindex, x, y, r, sx, sy, ox, oy, kx, ky ) texture Texture The Array Texture to draw. layerindex number The index of the layer to use when drawing. x (0) number The position to draw the texture (x-axis). y (0) number The position to draw the texture (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). love.graphics.drawLayer( texture, layerindex, quad, x, y, r, sx, sy, ox, oy, kx, ky ) texture Texture The Array Texture to draw. layerindex number The index of the layer to use when drawing. quad Quad The subsection of the texture's layer to use when drawing. x (0) number The position to draw the texture (x-axis). y (0) number The position to draw the texture (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). love.graphics.drawLayer( texture, layerindex, transform ) texture Texture The Array Texture to draw. layerindex number The index of the layer to use when drawing. transform Transform A transform object. love.graphics.drawLayer( texture, layerindex, quad, transform ) texture Texture The Array Texture to draw. layerindex number The index of the layer to use when drawing. quad Quad The subsection of the texture's layer to use when drawing. transform Transform A transform object.
love2d-community.github.io/love-api
love.graphics.ellipse
love.graphics.ellipse Draws an ellipse. love.graphics.ellipse( mode, x, y, radiusx, radiusy ) mode DrawMode How to draw the ellipse. x number The position of the center along x-axis. y number The position of the center along y-axis. radiusx number The radius of the ellipse along the x-axis (half the ellipse's width). radiusy number The radius of the ellipse along the y-axis (half the ellipse's height). love.graphics.ellipse( mode, x, y, radiusx, radiusy, segments ) mode DrawMode How to draw the ellipse. x number The position of the center along x-axis. y number The position of the center along y-axis. radiusx number The radius of the ellipse along the x-axis (half the ellipse's width). radiusy number The radius of the ellipse along the y-axis (half the ellipse's height). segments number The number of segments used for drawing the ellipse.
love2d-community.github.io/love-api
love.graphics.flushBatch
love.graphics.flushBatch Immediately renders any pending automatically batched draws. LÖVE will call this function internally as needed when most state is changed, so it is not necessary to manually call it. The current batch will be automatically flushed by love.graphics state changes (except for the transform stack and the current color), as well as Shader:send and methods on Textures which change their state. Using a different Image in consecutive love.graphics.draw calls will also flush the current batch. SpriteBatches, ParticleSystems, Meshes, and Text objects do their own batching and do not affect automatic batching of other draws, aside from flushing the current batch when they're drawn. love.graphics.flushBatch()
love2d-community.github.io/love-api
love.graphics.getBackgroundColor
love.graphics.getBackgroundColor Gets the current background color. 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 = love.graphics.getBackgroundColor() 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
love.graphics.getBlendMode
love.graphics.getBlendMode Gets the blending mode. mode, alphamode = love.graphics.getBlendMode() mode BlendMode The current blend mode. alphamode BlendAlphaMode The current blend alpha mode – it determines how the alpha of drawn objects affects blending.
love2d-community.github.io/love-api
love.graphics.getCanvas
love.graphics.getCanvas Gets the current target Canvas. canvas = love.graphics.getCanvas() canvas Canvas The Canvas set by setCanvas. Returns nil if drawing to the real screen.
love2d-community.github.io/love-api
love.graphics.getCanvasFormats
love.graphics.getCanvasFormats Gets the available Canvas formats, and whether each is supported. formats = love.graphics.getCanvasFormats() formats table A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats. formats = love.graphics.getCanvasFormats( readable ) readable boolean If true, the returned formats will only be indicated as supported if readable flag set to true for that format, and vice versa if the parameter is false. formats table A table containing CanvasFormats as keys, and a boolean indicating whether the format is supported as values (taking into account the readable parameter). Not all systems support all formats.
love2d-community.github.io/love-api
love.graphics.getColor
love.graphics.getColor Gets the current color. 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 = love.graphics.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
love.graphics.getColorMask
love.graphics.getColorMask Gets the active color components used when drawing. Normally all 4 components are active unless love.graphics.setColorMask has been used. The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well. r, g, b, a = love.graphics.getColorMask() r boolean Whether the red color component is active when rendering. g boolean Whether the green color component is active when rendering. b boolean Whether the blue color component is active when rendering. a boolean Whether the alpha color component is active when rendering.
love2d-community.github.io/love-api
love.graphics.getDPIScale
love.graphics.getDPIScale Gets the DPI scale factor of the window. The DPI scale factor represents relative pixel density. The pixel density inside the window might be greater (or smaller) than the 'size' of the window. For example on a retina screen in Mac OS X with the highdpi window flag enabled, the window may take up the same physical size as an 800x600 window, but the area inside the window uses 1600x1200 pixels. love.graphics.getDPIScale() would return 2 in that case. The love.window.fromPixels and love.window.toPixels functions can also be used to convert between units. The highdpi window flag must be enabled to use the full pixel density of a Retina screen on Mac OS X and iOS. The flag currently does nothing on Windows and Linux, and on Android it is effectively always enabled. scale = love.graphics.getDPIScale() scale number The pixel scale factor associated with the window.
love2d-community.github.io/love-api
love.graphics.getDefaultFilter
love.graphics.getDefaultFilter Returns the default scaling filters used with Images, Canvases, and Fonts. min, mag, anisotropy = love.graphics.getDefaultFilter() min FilterMode Filter mode used when scaling the image down. mag FilterMode Filter mode used when scaling the image up. anisotropy number Maximum amount of Anisotropic Filtering used.
love2d-community.github.io/love-api
love.graphics.getDepthMode
love.graphics.getDepthMode Gets the current depth test mode and whether writing to the depth buffer is enabled. This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. comparemode, write = love.graphics.getDepthMode() comparemode CompareMode Depth comparison mode used for depth testing. write boolean Whether to write update / write values to the depth buffer when rendering.
love2d-community.github.io/love-api
love.graphics.getDimensions
love.graphics.getDimensions Gets the width and height in pixels of the window. width, height = love.graphics.getDimensions() width number The width of the window. height number The height of the window.
love2d-community.github.io/love-api
love.graphics.getFont
love.graphics.getFont Gets the current Font object. font = love.graphics.getFont() font Font The current Font. Automatically creates and sets the default font, if none is set yet.
love2d-community.github.io/love-api
love.graphics.getFrontFaceWinding
love.graphics.getFrontFaceWinding Gets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. winding = love.graphics.getFrontFaceWinding() winding VertexWinding The winding mode being used. The default winding is counterclockwise ('ccw').
love2d-community.github.io/love-api
love.graphics.getHeight
love.graphics.getHeight Gets the height in pixels of the window. height = love.graphics.getHeight() height number The height of the window.
love2d-community.github.io/love-api
love.graphics.getImageFormats
love.graphics.getImageFormats Gets the raw and compressed pixel formats usable for Images, and whether each is supported. formats = love.graphics.getImageFormats() formats table A table containing PixelFormats as keys, and a boolean indicating whether the format is supported as values. Not all systems support all formats.
love2d-community.github.io/love-api
love.graphics.getLineJoin
love.graphics.getLineJoin Gets the line join style. join = love.graphics.getLineJoin() join LineJoin The LineJoin style.
love2d-community.github.io/love-api
love.graphics.getLineStyle
love.graphics.getLineStyle Gets the line style. style = love.graphics.getLineStyle() style LineStyle The current line style.
love2d-community.github.io/love-api
love.graphics.getLineWidth
love.graphics.getLineWidth Gets the current line width. width = love.graphics.getLineWidth() width number The current line width.
love2d-community.github.io/love-api
love.graphics.getMeshCullMode
love.graphics.getMeshCullMode Gets whether back-facing triangles in a Mesh are culled. Mesh face culling is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. mode = love.graphics.getMeshCullMode() mode CullMode The Mesh face culling mode in use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).
love2d-community.github.io/love-api
love.graphics.getPixelDimensions
love.graphics.getPixelDimensions Gets the width and height in pixels of the window. love.graphics.getDimensions gets the dimensions of the window in units scaled by the screen's DPI scale factor, rather than pixels. Use getDimensions for calculations related to drawing to the screen and using the graphics coordinate system (calculating the center of the screen, for example), and getPixelDimensions only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). pixelwidth, pixelheight = love.graphics.getPixelDimensions() pixelwidth number The width of the window in pixels. pixelheight number The height of the window in pixels.
love2d-community.github.io/love-api
love.graphics.getPixelHeight
love.graphics.getPixelHeight Gets the height in pixels of the window. The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getHeight for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelHeight only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). pixelheight = love.graphics.getPixelHeight() pixelheight number The height of the window in pixels.
love2d-community.github.io/love-api
love.graphics.getPixelWidth
love.graphics.getPixelWidth Gets the width in pixels of the window. The graphics coordinate system and DPI scale factor, rather than raw pixels. Use getWidth for calculations related to drawing to the screen and using the coordinate system (calculating the center of the screen, for example), and getPixelWidth only when dealing specifically with underlying pixels (pixel-related calculations in a pixel Shader, for example). pixelwidth = love.graphics.getPixelWidth() pixelwidth number The width of the window in pixels.
love2d-community.github.io/love-api
love.graphics.getPointSize
love.graphics.getPointSize Gets the point size. size = love.graphics.getPointSize() size number The current point size.
love2d-community.github.io/love-api
love.graphics.getRendererInfo
love.graphics.getRendererInfo Gets information about the system's video card and drivers. name, version, vendor, device = love.graphics.getRendererInfo() name string The name of the renderer, e.g. 'OpenGL' or 'OpenGL ES'. version string The version of the renderer with some extra driver-dependent version info, e.g. '2.1 INTEL-8.10.44'. vendor string The name of the graphics card vendor, e.g. 'Intel Inc'. device string The name of the graphics card, e.g. 'Intel HD Graphics 3000 OpenGL Engine'.
love2d-community.github.io/love-api
love.graphics.getScissor
love.graphics.getScissor Gets the current scissor box. x, y, width, height = love.graphics.getScissor() x number The x-component of the top-left point of the box. y number The y-component of the top-left point of the box. width number The width of the box. height number The height of the box.
love2d-community.github.io/love-api
love.graphics.getShader
love.graphics.getShader Gets the current Shader. Returns nil if none is set. shader = love.graphics.getShader() shader Shader The currently active Shader, or nil if none is set.
love2d-community.github.io/love-api
love.graphics.getStackDepth
love.graphics.getStackDepth Gets the current depth of the transform / state stack (the number of pushes without corresponding pops). depth = love.graphics.getStackDepth() depth number The current depth of the transform and state love.graphics stack.
love2d-community.github.io/love-api
love.graphics.getStats
love.graphics.getStats Gets performance-related rendering statistics. stats = love.graphics.getStats() stats table A table with the following fields: stats.drawcalls number The number of draw calls made so far during the current frame. stats.canvasswitches number The number of times the active Canvas has been switched so far during the current frame. stats.texturememory number The estimated total size in bytes of video memory used by all loaded Images, Canvases, and Fonts. stats.images number The number of Image objects currently loaded. stats.canvases number The number of Canvas objects currently loaded. stats.fonts number The number of Font objects currently loaded. stats.shaderswitches number The number of times the active Shader has been changed so far during the current frame. stats.drawcallsbatched number The number of draw calls that were saved by LÖVE's automatic batching, since the start of the frame. stats = love.graphics.getStats( stats ) stats table A table which will be filled in with the stat fields below. stats table The table that was passed in above, now containing the following fields: stats.drawcalls number The number of draw calls made so far during the current frame. stats.canvasswitches number The number of times the active Canvas has been switched so far during the current frame. stats.texturememory number The estimated total size in bytes of video memory used by all loaded Images, Canvases, and Fonts. stats.images number The number of Image objects currently loaded. stats.canvases number The number of Canvas objects currently loaded. stats.fonts number The number of Font objects currently loaded. stats.shaderswitches number The number of times the active Shader has been changed so far during the current frame. stats.drawcallsbatched number The number of draw calls that were saved by LÖVE's automatic batching, since the start of the frame.
love2d-community.github.io/love-api
love.graphics.getStencilTest
love.graphics.getStencilTest Gets the current stencil test configuration. When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. Each Canvas has its own per-pixel stencil values. comparemode, comparevalue = love.graphics.getStencilTest() comparemode CompareMode The type of comparison that is made for each pixel. Will be 'always' if stencil testing is disabled. comparevalue number The value used when comparing with the stencil value of each pixel.
love2d-community.github.io/love-api
love.graphics.getSupported
love.graphics.getSupported Gets the optional graphics features and whether they're supported on the system. Some older or low-end systems don't always support all graphics features. features = love.graphics.getSupported() features table A table containing GraphicsFeature keys, and boolean values indicating whether each feature is supported.
love2d-community.github.io/love-api
love.graphics.getSystemLimits
love.graphics.getSystemLimits Gets the system-dependent maximum values for love.graphics features. limits = love.graphics.getSystemLimits() limits table A table containing GraphicsLimit keys, and number values.
love2d-community.github.io/love-api
love.graphics.getTextureTypes
love.graphics.getTextureTypes Gets the available texture types, and whether each is supported. texturetypes = love.graphics.getTextureTypes() texturetypes table A table containing TextureTypes as keys, and a boolean indicating whether the type is supported as values. Not all systems support all types.
love2d-community.github.io/love-api
love.graphics.getWidth
love.graphics.getWidth Gets the width in pixels of the window. width = love.graphics.getWidth() width number The width of the window.
love2d-community.github.io/love-api
love.graphics.intersectScissor
love.graphics.intersectScissor Sets the scissor to the rectangle created by the intersection of the specified rectangle with the existing scissor. If no scissor is active yet, it behaves like love.graphics.setScissor. The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). love.graphics.intersectScissor( x, y, width, height ) x number The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. y number The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. width number The width of the rectangle to intersect with the existing scissor rectangle. height number The height of the rectangle to intersect with the existing scissor rectangle.
love2d-community.github.io/love-api
love.graphics.inverseTransformPoint
love.graphics.inverseTransformPoint Converts the given 2D position from screen-space into global coordinates. This effectively applies the reverse of the current graphics transformations to the given position. A similar Transform:inverseTransformPoint method exists for Transform objects. globalX, globalY = love.graphics.inverseTransformPoint( screenX, screenY ) screenX number The x component of the screen-space position. screenY number The y component of the screen-space position. 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
love.graphics.isActive
love.graphics.isActive Gets whether the graphics module is able to be used. If it is not active, love.graphics function and method calls will not work correctly and may cause the program to crash. The graphics module is inactive if a window is not open, or if the app is in the background on iOS. Typically the app's execution will be automatically paused by the system, in the latter case. active = love.graphics.isActive() active boolean Whether the graphics module is active and able to be used.
love2d-community.github.io/love-api
love.graphics.isGammaCorrect
love.graphics.isGammaCorrect Gets whether gamma-correct rendering is supported and enabled. It can be enabled by setting t.gammacorrect = true in love.conf. Not all devices support gamma-correct rendering, in which case it will be automatically disabled and this function will return false. It is supported on desktop systems which have graphics cards that are capable of using OpenGL 3 / DirectX 10, and iOS devices that can use OpenGL ES 3. gammacorrect = love.graphics.isGammaCorrect() gammacorrect boolean True if gamma-correct rendering is supported and was enabled in love.conf, false otherwise.
love2d-community.github.io/love-api
love.graphics.isWireframe
love.graphics.isWireframe Gets whether wireframe mode is used when drawing. wireframe = love.graphics.isWireframe() wireframe boolean True if wireframe lines are used when drawing, false if it's not.
love2d-community.github.io/love-api
love.graphics.line
love.graphics.line Draws lines between points. love.graphics.line( x1, y1, x2, y2, ... ) x1 number The position of first point on the x-axis. y1 number The position of first point on the y-axis. x2 number The position of second point on the x-axis. y2 number The position of second point on the y-axis. ... number You can continue passing point positions to draw a polyline. love.graphics.line( points ) points table A table of point positions, as described above.
love2d-community.github.io/love-api
love.graphics.newArrayImage
love.graphics.newArrayImage Creates a new array Image. An array image / array texture is a single object which contains multiple 'layers' or 'slices' of 2D sub-images. It can be thought of similarly to a texture atlas or sprite sheet, but it doesn't suffer from the same tile / quad bleeding artifacts that texture atlases do – although every sub-image must have the same dimensions. A specific layer of an array image can be drawn with love.graphics.drawLayer / SpriteBatch:addLayer, or with the Quad variant of love.graphics.draw and Quad:setLayer, or via a custom Shader. To use an array image in a Shader, it must be declared as a ArrayImage or sampler2DArray type (instead of Image or sampler2D). The Texel(ArrayImage image, vec3 texturecoord) shader function must be used to get pixel colors from a slice of the array image. The vec3 argument contains the texture coordinate in the first two components, and the 0-based slice index in the third component. image = love.graphics.newArrayImage( slices, settings ) slices table A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each sub-image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the slice index of that sub-table. settings (nil) table Optional table of settings to configure the array image, containing the following fields: settings.mipmaps (false) boolean True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn't a compressed texture format. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. settings.dpiscale (1) number The DPI scale to use when drawing the array image and calling getWidth/getHeight. image Image An Array Image object.
love2d-community.github.io/love-api
love.graphics.newCanvas
love.graphics.newCanvas Creates a new Canvas object for offscreen rendering. canvas = love.graphics.newCanvas() canvas Canvas A new Canvas with dimensions equal to the window's size in pixels. canvas = love.graphics.newCanvas( width, height ) width number The desired width of the Canvas. height number The desired height of the Canvas. canvas Canvas A new Canvas with specified width and height. canvas = love.graphics.newCanvas( width, height, settings ) width number The desired width of the Canvas. height number The desired height of the Canvas. settings table A table containing the given fields: settings.type ('2d') TextureType The type of Canvas to create. settings.format ('normal') PixelFormat The format of the Canvas. settings.readable boolean Whether the Canvas is readable (drawable and accessible in a Shader). True by default for regular formats, false by default for depth/stencil formats. settings.msaa (0) number The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas. settings.dpiscale (love.graphics.getDPIScale()) number The DPI scale factor of the Canvas, used when drawing to the Canvas as well as when drawing the Canvas to the screen. settings.mipmaps ('none') MipmapMode Whether the Canvas has mipmaps, and whether to automatically regenerate them if so. canvas Canvas A new Canvas with specified width and height. canvas = love.graphics.newCanvas( width, height, layers, settings ) width number The desired width of the Canvas. height number The desired height of the Canvas. layers number The number of array layers (if the Canvas is an Array Texture), or the volume depth (if the Canvas is a Volume Texture). settings table A table containing the given fields: settings.type ('array') TextureType The type of Canvas to create. settings.format ('normal') PixelFormat The format of the Canvas. settings.readable boolean Whether the Canvas is readable (drawable and accessible in a Shader). True by default for regular formats, false by default for depth/stencil formats. settings.msaa (0) number The desired number of multisample antialiasing (MSAA) samples used when drawing to the Canvas. settings.dpiscale (love.graphics.getDPIScale()) number The DPI scale factor of the Canvas, used when drawing to the Canvas as well as when drawing the Canvas to the screen. settings.mipmaps ('none') MipmapMode Whether the Canvas has mipmaps, and whether to automatically regenerate them if so. canvas Canvas A new Canvas with specified width and height.
love2d-community.github.io/love-api
love.graphics.newCubeImage
love.graphics.newCubeImage Creates a new cubemap Image. Cubemap images have 6 faces (sides) which represent a cube. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). To use a cubemap image in a Shader, it must be declared as a CubeImage or samplerCube type (instead of Image or sampler2D). The Texel(CubeImage image, vec3 direction) shader function must be used to get pixel colors from the cubemap. The vec3 argument is a normalized direction from the center of the cube, rather than explicit texture coordinates. Each face in a cubemap image must have square dimensions. For variants of this function which accept a single image containing multiple cubemap faces, they must be laid out in one of the following forms in the image: +y +z +x -z -y -x or: +y -x +z +x -z -y or: +x -x +y -y +z -z or: +x -x +y -y +z -z image = love.graphics.newCubeImage( filename, settings ) filename string The filepath to a cubemap image file (or a File, FileData, or ImageData). settings (nil) table Optional table of settings to configure the cubemap image, containing the following fields: settings.mipmaps (false) boolean True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn't a compressed texture format. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. image Image An cubemap Image object. image = love.graphics.newCubeImage( faces, settings ) faces table A table containing 6 filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. Each face image must have the same dimensions. A table of tables can also be given, where each sub-table contains all mipmap levels for the cube face index of that sub-table. settings (nil) table Optional table of settings to configure the cubemap image, containing the following fields: settings.mipmaps (false) boolean True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn't a compressed texture format. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. image Image An cubemap Image object.
love2d-community.github.io/love-api
love.graphics.newFont
love.graphics.newFont Creates a new Font from a TrueType Font or BMFont file. Created fonts are not cached, in that calling this function with the same arguments will always create a new Font object. All variants which accept a filename can also accept a Data object instead. font = love.graphics.newFont( filename ) filename string The filepath to the BMFont or TrueType font file. font Font A Font object which can be used to draw text on screen. font = love.graphics.newFont( filename, size, hinting, dpiscale ) filename string The filepath to the TrueType font file. size number The size of the font in pixels. hinting ('normal') HintingMode True Type hinting mode. dpiscale (love.graphics.getDPIScale()) number The DPI scale factor of the font. font Font A Font object which can be used to draw text on screen. font = love.graphics.newFont( filename, imagefilename ) filename string The filepath to the BMFont file. imagefilename string The filepath to the BMFont's image file. If this argument is omitted, the path specified inside the BMFont file will be used. font Font A Font object which can be used to draw text on screen. font = love.graphics.newFont( size, hinting, dpiscale ) size (12) number The size of the font in pixels. hinting ('normal') HintingMode True Type hinting mode. dpiscale (love.graphics.getDPIScale()) number The DPI scale factor of the font. font Font A Font object which can be used to draw text on screen.
love2d-community.github.io/love-api
love.graphics.newImage
love.graphics.newImage Creates a new Image from a filepath, FileData, an ImageData, or a CompressedImageData, and optionally generates or specifies mipmaps for the image. image = love.graphics.newImage( filename, settings ) filename string The filepath to the image file. settings table A table containing the following fields: settings.dpiscale (1) number The DPI scale to use when drawing the image and calling getWidth/getHeight. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. settings.mipmaps (false) boolean If true, mipmaps for the image will be automatically generated (or taken from the images's file if possible, if the image originated from a CompressedImageData). image Image A new Image object which can be drawn on screen. image = love.graphics.newImage( fileData, settings ) fileData FileData The FileData containing image file. settings table A table containing the following fields: settings.dpiscale (1) number The DPI scale to use when drawing the image and calling getWidth/getHeight. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. settings.mipmaps (false) boolean If true, mipmaps for the image will be automatically generated (or taken from the images's file if possible, if the image originated from a CompressedImageData). image Image A new Image object which can be drawn on screen. image = love.graphics.newImage( imageData, settings ) imageData ImageData The ImageData containing image. settings table A table containing the following fields: settings.dpiscale (1) number The DPI scale to use when drawing the image and calling getWidth/getHeight. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. settings.mipmaps (false) boolean If true, mipmaps for the image will be automatically generated (or taken from the images's file if possible, if the image originated from a CompressedImageData). image Image A new Image object which can be drawn on screen. image = love.graphics.newImage( compressedImageData, settings ) compressedImageData CompressedImageData A CompressedImageData object. The Image will use this CompressedImageData to reload itself when love.window.setMode is called. settings table A table containing the following fields: settings.dpiscale (1) number The DPI scale to use when drawing the image and calling getWidth/getHeight. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. settings.mipmaps (false) boolean If true, mipmaps for the image will be automatically generated (or taken from the images's file if possible, if the image originated from a CompressedImageData). image Image A new Image object which can be drawn on screen.
love2d-community.github.io/love-api
love.graphics.newImageFont
love.graphics.newImageFont Creates a new specifically formatted image. In versions prior to 0.9.0, LÖVE expects ISO 8859-1 encoding for the glyphs string. font = love.graphics.newImageFont( filename, glyphs ) filename string The filepath to the image file. glyphs string A string of the characters in the image in order from left to right. font Font A Font object which can be used to draw text on screen. font = love.graphics.newImageFont( imageData, glyphs ) imageData ImageData The ImageData object to create the font from. glyphs string A string of the characters in the image in order from left to right. font Font A Font object which can be used to draw text on screen. font = love.graphics.newImageFont( filename, glyphs, extraspacing ) filename string The filepath to the image file. glyphs string A string of the characters in the image in order from left to right. extraspacing number Additional spacing (positive or negative) to apply to each glyph in the Font. font Font A Font object which can be used to draw text on screen.
love2d-community.github.io/love-api
love.graphics.newMesh
love.graphics.newMesh Creates a new Mesh. Use Mesh:setTexture if the Mesh should be textured with an Image or Canvas when it's drawn. In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. mesh = love.graphics.newMesh( vertices, mode, usage ) vertices table The table filled with vertex information tables for each vertex as follows: vertices.1 number The position of the vertex on the x-axis. vertices.2 number The position of the vertex on the y-axis. vertices.3 (0) number The u texture coordinate of the vertex. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.) vertices.4 (0) number The v texture coordinate of the vertex. Texture coordinates are normally in the range of 1, but can be greater or less (see WrapMode.) vertices.5 (1) number The red component of the vertex color. vertices.6 (1) number The green component of the vertex color. vertices.7 (1) number The blue component of the vertex color. vertices.8 (1) number The alpha component of the vertex color. mode ('fan') MeshDrawMode How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. usage ('dynamic') SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. mesh Mesh The new mesh. mesh = love.graphics.newMesh( vertexcount, mode, usage ) vertexcount number The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 1,1,1,1}. mode ('fan') MeshDrawMode How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. usage ('dynamic') SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. mesh Mesh The new mesh. mesh = love.graphics.newMesh( vertexformat, vertices, mode, usage ) vertexformat table A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex. vertexformat.attribute table A table containing the attribute's name, it's data type, and the number of components in the attribute, in the form of {name, datatype, components}. vertexformat.... table Additional vertex attribute format tables. vertices table The table filled with vertex information tables for each vertex, in the form of {vertex, ...} where each vertex is a table in the form of {attributecomponent, ...}. vertices.attributecomponent number The first component of the first vertex attribute in the vertex. vertices.... number Additional components of all vertex attributes in the vertex. mode ('fan') MeshDrawMode How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. usage ('dynamic') SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. mesh Mesh The new mesh. mesh = love.graphics.newMesh( vertexformat, vertexcount, mode, usage ) vertexformat table A table in the form of {attribute, ...}. Each attribute is a table which specifies a custom vertex attribute used for each vertex. vertexformat.attribute table A table containing the attribute's name, it's data type, and the number of components in the attribute, in the form of {name, datatype, components}. vertexformat.... table Additional vertex attribute format tables. vertexcount number The total number of vertices the Mesh will use. mode ('fan') MeshDrawMode How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. usage ('dynamic') SpriteBatchUsage The expected usage of the Mesh. The specified usage mode affects the Mesh's memory usage and performance. mesh Mesh The new mesh. mesh = love.graphics.newMesh( vertexcount, texture, mode ) vertexcount number The total number of vertices the Mesh will use. Each vertex is initialized to {0,0, 0,0, 255,255,255,255}. texture (nil) Texture The Image or Canvas to use when drawing the Mesh. May be nil to use no texture. mode ('fan') MeshDrawMode How the vertices are used when drawing. The default mode 'fan' is sufficient for simple convex polygons. mesh Mesh The new mesh.
love2d-community.github.io/love-api
love.graphics.newParticleSystem
love.graphics.newParticleSystem Creates a new ParticleSystem. system = love.graphics.newParticleSystem( image, buffer ) image Image The image to use. buffer (1000) number The max number of particles at the same time. system ParticleSystem A new ParticleSystem. system = love.graphics.newParticleSystem( texture, buffer ) texture Texture The texture (Image or Canvas) to use. buffer (1000) number The max number of particles at the same time. system ParticleSystem A new ParticleSystem.
love2d-community.github.io/love-api
love.graphics.newQuad
love.graphics.newQuad Creates a new Quad. The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation. quad = love.graphics.newQuad( x, y, width, height, sw, sh ) x number The top-left position in the Image along the x-axis. y number The top-left position in the Image along the y-axis. width number The width of the Quad in the Image. (Must be greater than 0.) height number The height of the Quad in the Image. (Must be greater than 0.) 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.) quad Quad The new Quad. quad = love.graphics.newQuad( x, y, width, height, texture ) x number The top-left position in the Image along the x-axis. y number The top-left position in the Image along the y-axis. width number The width of the Quad in the Image. (Must be greater than 0.) height number The height of the Quad in the Image. (Must be greater than 0.) texture Texture The texture whose width and height will be used as the reference width and height. quad Quad The new Quad.
love2d-community.github.io/love-api
love.graphics.newShader
love.graphics.newShader Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both. Shaders are small programs which are run on the graphics card when drawing. Vertex shaders are run once for each vertex (for example, an image has 4 vertices - one at each corner. A Mesh might have many more.) Pixel shaders are run once for each pixel on the screen which the drawn object touches. Pixel shader code is executed after all the object's vertices have been processed by the vertex shader. shader = love.graphics.newShader( code ) code string The pixel shader or vertex shader code, or a filename pointing to a file with the code. shader Shader A Shader object for use in drawing operations. shader = love.graphics.newShader( pixelcode, vertexcode ) pixelcode string The pixel shader code, or a filename pointing to a file with the code. vertexcode string The vertex shader code, or a filename pointing to a file with the code. shader Shader A Shader object for use in drawing operations.
love2d-community.github.io/love-api
love.graphics.newSpriteBatch
love.graphics.newSpriteBatch Creates a new SpriteBatch object. spriteBatch = love.graphics.newSpriteBatch( image, maxsprites ) image Image The Image to use for the sprites. maxsprites (1000) number The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch. spriteBatch SpriteBatch The new SpriteBatch. spriteBatch = love.graphics.newSpriteBatch( image, maxsprites, usage ) image Image The Image to use for the sprites. maxsprites (1000) number The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch. usage ('dynamic') SpriteBatchUsage The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch's memory usage and performance. spriteBatch SpriteBatch The new SpriteBatch. spriteBatch = love.graphics.newSpriteBatch( texture, maxsprites, usage ) texture Texture The Image or Canvas to use for the sprites. maxsprites (1000) number The maximum number of sprites that the SpriteBatch can contain at any given time. Since version 11.0, additional sprites added past this number will automatically grow the spritebatch. usage ('dynamic') SpriteBatchUsage The expected usage of the SpriteBatch. The specified usage mode affects the SpriteBatch's memory usage and performance. spriteBatch SpriteBatch The new SpriteBatch.
love2d-community.github.io/love-api
love.graphics.newText
love.graphics.newText Creates a new drawable Text object. text = love.graphics.newText( font, textstring ) font Font The font to use for the text. textstring (nil) string The initial string of text that the new Text object will contain. May be nil. text Text The new drawable Text object. text = love.graphics.newText( font, coloredtext ) font Font The font to use for the text. 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.... Variant Additional colors and strings. text Text The new drawable Text object.
love2d-community.github.io/love-api
love.graphics.newVideo
love.graphics.newVideo Creates a new drawable Video. Currently only Ogg Theora video files are supported. video = love.graphics.newVideo( filename ) filename string The file path to the Ogg Theora video file. video Video A new Video. video = love.graphics.newVideo( videostream ) videostream VideoStream A video stream object. video Video A new Video. video = love.graphics.newVideo( filename, settings ) filename string The file path to the Ogg Theora video file (or VideoStream). settings table A table containing the following fields: settings.audio (false) boolean Whether to try to load the video's audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio. settings.dpiscale (love.graphics.getDPIScale()) number The DPI scale factor of the video. video Video A new Video. video = love.graphics.newVideo( filename, loadaudio ) filename string The file path to the Ogg Theora video file. loadaudio (nil) boolean Whether to try to load the video's audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio. video Video A new Video. video = love.graphics.newVideo( videostream, loadaudio ) videostream VideoStream A video stream object. loadaudio (nil) boolean Whether to try to load the video's audio into an audio Source. If not explicitly set to true or false, it will try without causing an error if the video has no audio. video Video A new Video.
love2d-community.github.io/love-api
love.graphics.newVolumeImage
love.graphics.newVolumeImage Creates a new volume (3D) Image. Volume images are 3D textures with width, height, and depth. They can't be rendered directly, they can only be used in Shader code (and sent to the shader via Shader:send). To use a volume image in a Shader, it must be declared as a VolumeImage or sampler3D type (instead of Image or sampler2D). The Texel(VolumeImage image, vec3 texcoords) shader function must be used to get pixel colors from the volume image. The vec3 argument is a normalized texture coordinate with the z component representing the depth to sample at (ranging from 1). Volume images are typically used as lookup tables in shaders for color grading, for example, because sampling using a texture coordinate that is partway in between two pixels can interpolate across all 3 dimensions in the volume image, resulting in a smooth gradient even when a small-sized volume image is used as the lookup table. Array images are a much better choice than volume images for storing multiple different sprites in a single array image for directly drawing them. image = love.graphics.newVolumeImage( layers, settings ) layers table A table containing filepaths to images (or File, FileData, ImageData, or CompressedImageData objects), in an array. A table of tables can also be given, where each sub-table represents a single mipmap level and contains all layers for that mipmap. settings (nil) table Optional table of settings to configure the volume image, containing the following fields: settings.mipmaps (false) boolean True to make the image use mipmaps, false to disable them. Mipmaps will be automatically generated if the image isn't a compressed texture format. settings.linear (false) boolean True to treat the image's pixels as linear instead of sRGB, when gamma correct rendering is enabled. Most images are authored as sRGB. image Image A volume Image object.
love2d-community.github.io/love-api
love.graphics.origin
love.graphics.origin Resets the current coordinate transformation. This function is always used to reverse any previous calls to love.graphics.rotate, love.graphics.scale, love.graphics.shear or love.graphics.translate. It returns the current transformation state to its defaults. love.graphics.origin()
love2d-community.github.io/love-api
love.graphics.points
love.graphics.points Draws one or more points. love.graphics.points( x, y, ... ) x number The position of the first point on the x-axis. y number The position of the first point on the y-axis. ... number The x and y coordinates of additional points. love.graphics.points( points ) points table A table containing multiple point positions, in the form of {x, y, ...}. love.graphics.points( points ) points table A table containing multiple individually colored points, in the form of {point, ...}. points.point table A table containing the position and color of the first point, in the form of {x, y, r, g, b, a}. The color components are optional. points.... table Additional tables containing the position and color of more points, in the form of {x, y, r, g, b, a}. The color components are optional.
love2d-community.github.io/love-api
love.graphics.polygon
love.graphics.polygon Draw a polygon. Following the mode argument, this function can accept multiple numeric arguments or a single table of numeric arguments. In either case the arguments are interpreted as alternating x and y coordinates of the polygon's vertices. love.graphics.polygon( mode, ... ) mode DrawMode How to draw the polygon. ... number The vertices of the polygon. love.graphics.polygon( mode, vertices ) mode DrawMode How to draw the polygon. vertices table The vertices of the polygon as a table.
love2d-community.github.io/love-api
love.graphics.pop
love.graphics.pop Pops the current coordinate transformation from the transformation stack. This function is always used to reverse a previous push operation. It returns the current transformation state to what it was before the last preceding push. love.graphics.pop()
love2d-community.github.io/love-api
love.graphics.present
love.graphics.present Displays the results of drawing operations on the screen. This function is used when writing your own love.run function. It presents all the results of your drawing operations on the screen. See the example in love.run for a typical use of this function. love.graphics.present()
love2d-community.github.io/love-api
love.graphics.print
love.graphics.print Draws text on screen. If no Font is set, one will be created and set (once) if needed. As of LOVE 0.7.1, when using translation and scaling functions while drawing text, this function assumes the scale occurs first. If you don't script with this in mind, the text won't be in the right position, or possibly even on screen. love.graphics.print and love.graphics.printf both support UTF-8 encoding. You'll also need a proper Font for special characters. In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. love.graphics.print( text, x, y, r, sx, sy, ox, oy, kx, ky ) text string The text to draw. x (0) number The position to draw the object (x-axis). y (0) 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 Shearing factor (x-axis). ky (0) number Shearing factor (y-axis). love.graphics.print( 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 text on the x-axis. y (0) number The position of the text on the y-axis. angle (0) number The orientation of the 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. love.graphics.print( text, transform ) text string The text to draw. transform Transform Transformation object. love.graphics.print( coloredtext, transform ) 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. transform Transform Transformation object. love.graphics.print( text, font, transform ) text string The text to draw. font Font The Font object to use. transform Transform Transformation object. love.graphics.print( coloredtext, font, transform ) 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. font Font The Font object to use. transform Transform Transformation object.
love2d-community.github.io/love-api
love.graphics.printf
love.graphics.printf Draws formatted text, with word wrap and alignment. See additional notes in love.graphics.print. 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. In version 0.9.2 and earlier, wrapping was implemented by breaking up words by spaces and putting them back together to make sure things fit nicely within the limit provided. However, due to the way this is done, extra spaces between words would end up missing when printed on the screen, and some lines could overflow past the provided wrap limit. In version 0.10.0 and newer this is no longer the case. In versions prior to 11.0, color and byte component values were within the range of 0 to 255 instead of 0 to 1. love.graphics.printf( text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky ) text string A text string. x number The position on the x-axis. y number The position on the y-axis. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. 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). love.graphics.printf( text, font, x, y, limit, align, r, sx, sy, ox, oy, kx, ky ) text string A text string. font Font The Font object to use. x number The position on the x-axis. y number The position on the y-axis. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. 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). love.graphics.printf( text, transform, limit, align ) text string A text string. transform Transform Transformation object. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. love.graphics.printf( text, font, transform, limit, align ) text string A text string. font Font The Font object to use. transform Transform Transformation object. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. love.graphics.printf( coloredtext, x, y, limit, align, 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 number The position of the text (x-axis). y number The position of the text (y-axis). limit 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. 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). love.graphics.printf( coloredtext, font, x, y, limit, align, 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. font Font The Font object to use. x number The position on the x-axis. y number The position on the y-axis. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. 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 factor (x-axis). ky (0) number Shearing factor (y-axis). love.graphics.printf( coloredtext, transform, limit, align ) 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. transform Transform Transformation object. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment. love.graphics.printf( coloredtext, font, transform, limit, align ) 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. font Font The Font object to use. transform Transform Transformation object. limit number Wrap the line after this many horizontal pixels. align ('left') AlignMode The alignment.
love2d-community.github.io/love-api
love.graphics.push
love.graphics.push Copies and pushes the current coordinate transformation to the transformation stack. This function is always used to prepare for a corresponding pop operation later. It stores the current coordinate transformation state into the transformation stack and keeps it active. Later changes to the transformation can be undone by using the pop operation, which returns the coordinate transform to the state it was in before calling push. love.graphics.push() love.graphics.push( stack ) stack StackType The type of stack to push (e.g. just transformation state, or all love.graphics state).
love2d-community.github.io/love-api
love.graphics.rectangle
love.graphics.rectangle Draws a rectangle. love.graphics.rectangle( mode, x, y, width, height ) mode DrawMode How to draw the rectangle. x number The position of top-left corner along the x-axis. y number The position of top-left corner along the y-axis. width number Width of the rectangle. height number Height of the rectangle. love.graphics.rectangle( mode, x, y, width, height, rx, ry, segments ) mode DrawMode How to draw the rectangle. x number The position of top-left corner along the x-axis. y number The position of top-left corner along the y-axis. width number Width of the rectangle. height number Height of the rectangle. rx number The x-axis radius of each round corner. Cannot be greater than half the rectangle's width. ry (rx) number The y-axis radius of each round corner. Cannot be greater than half the rectangle's height. segments (nil) number The number of segments used for drawing the round corners. A default amount will be chosen if no number is given.
love2d-community.github.io/love-api
love.graphics.replaceTransform
love.graphics.replaceTransform Replaces the current coordinate transformation with the given Transform object. love.graphics.replaceTransform( transform ) transform Transform The Transform object to replace the current graphics coordinate transform with.
love2d-community.github.io/love-api
love.graphics.reset
love.graphics.reset Resets the current graphics settings. Calling reset makes the current drawing color white, the current background color black, disables any active color component masks, disables wireframe mode and resets the current graphics transformation to the origin. It also sets both the point and line drawing modes to smooth and their sizes to 1.0. love.graphics.reset()
love2d-community.github.io/love-api
love.graphics.rotate
love.graphics.rotate Rotates the coordinate system in two dimensions. Calling this function affects all future drawing operations by rotating the coordinate system around the origin by the given amount of radians. This change lasts until love.draw() exits. love.graphics.rotate( angle ) angle number The amount to rotate the coordinate system in radians.
love2d-community.github.io/love-api
love.graphics.scale
love.graphics.scale Scales the coordinate system in two dimensions. By default the coordinate system in LÖVE corresponds to the display pixels in horizontal and vertical directions one-to-one, and the x-axis increases towards the right while the y-axis increases downwards. Scaling the coordinate system changes this relation. After scaling by sx and sy, all coordinates are treated as if they were multiplied by sx and sy. Every result of a drawing operation is also correspondingly scaled, so scaling by (2, 2) for example would mean making everything twice as large in both x- and y-directions. Scaling by a negative value flips the coordinate system in the corresponding direction, which also means everything will be drawn flipped or upside down, or both. Scaling by zero is not a useful operation. Scale and translate are not commutative operations, therefore, calling them in different orders will change the outcome. Scaling lasts until love.draw() exits. love.graphics.scale( sx, sy ) sx number The scaling in the direction of the x-axis. sy (sx) number The scaling in the direction of the y-axis. If omitted, it defaults to same as parameter sx.
love2d-community.github.io/love-api
love.graphics.setBackgroundColor
love.graphics.setBackgroundColor Sets the background color. love.graphics.setBackgroundColor( red, green, blue, alpha ) red number The red component (0-1). green number The green component (0-1). blue number The blue component (0-1). alpha (1) number The alpha component (0-1). love.graphics.setBackgroundColor( rgba ) rgba table A numerical indexed table with the red, green, blue and alpha values as numbers. The alpha is optional and defaults to 1 if it is left out.
love2d-community.github.io/love-api
love.graphics.setBlendMode
love.graphics.setBlendMode Sets the blending mode. love.graphics.setBlendMode( mode ) mode BlendMode The blend mode to use. love.graphics.setBlendMode( mode, alphamode ) mode BlendMode The blend mode to use. alphamode ('alphamultiply') BlendAlphaMode What to do with the alpha of drawn objects when blending.
love2d-community.github.io/love-api
love.graphics.setCanvas
love.graphics.setCanvas Captures drawing operations to a Canvas. love.graphics.setCanvas( canvas, mipmap ) canvas Canvas The new target. mipmap (1) number The mipmap level to render to, for Canvases with mipmaps. love.graphics.setCanvas() love.graphics.setCanvas( canvas1, canvas2, ... ) canvas1 Canvas The first render target. canvas2 Canvas The second render target. ... Canvas More canvases. love.graphics.setCanvas( canvas, slice, mipmap ) canvas Canvas The new render target. slice number For cubemaps this is the cube face index to render to (between 1 and 6). For Array textures this is the array layer. For volume textures this is the depth slice. 2D canvases should use a value of 1. mipmap (1) number The mipmap level to render to, for Canvases with mipmaps. love.graphics.setCanvas( setup ) setup table A table specifying the active Canvas(es), their mipmap levels and active layers if applicable, and whether to use a stencil and/or depth buffer. setup.1 RenderTargetSetup The Canvas to render to. setup.2 (nil) RenderTargetSetup An additional Canvas to render to, if multiple simultaneous render targets are wanted. setup.... RenderTargetSetup Additional Canvases to render to, if multiple simultaneous render targets are wanted. setup.stencil (false) boolean Whether an internally managed stencil buffer should be used, if the depthstencil field isn't set. setup.depth (false) boolean Whether an internally managed depth buffer should be used, if the depthstencil field isn't set. setup.depthstencil (nil) RenderTargetSetup An optional custom depth/stencil formatted Canvas to use for the depth and/or stencil buffer.
love2d-community.github.io/love-api
love.graphics.setColor
love.graphics.setColor Sets the color used for drawing. In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. love.graphics.setColor( red, green, blue, alpha ) red number The amount of red. green number The amount of green. blue number The amount of blue. alpha (1) number The amount of alpha. The alpha value will be applied to all subsequent draw operations, even the drawing of an image. love.graphics.setColor( rgba ) rgba table A numerical indexed table with the red, green, blue and alpha values as numbers. The alpha is optional and defaults to 1 if it is left out.
love2d-community.github.io/love-api
love.graphics.setColorMask
love.graphics.setColorMask Sets the color mask. Enables or disables specific color components when rendering and clearing the screen. For example, if '''red''' is set to '''false''', no further changes will be made to the red component of any pixels. love.graphics.setColorMask( red, green, blue, alpha ) red boolean Render red component. green boolean Render green component. blue boolean Render blue component. alpha boolean Render alpha component. love.graphics.setColorMask()
love2d-community.github.io/love-api
love.graphics.setDefaultFilter
love.graphics.setDefaultFilter Sets the default scaling filters used with Images, Canvases, and Fonts. love.graphics.setDefaultFilter( min, mag, anisotropy ) min FilterMode Filter mode used when scaling the image down. mag (min) FilterMode Filter mode used when scaling the image up. anisotropy (1) number Maximum amount of Anisotropic Filtering used.
love2d-community.github.io/love-api
love.graphics.setDepthMode
love.graphics.setDepthMode Configures depth testing and writing to the depth buffer. This is low-level functionality designed for use with custom vertex shaders and Meshes with custom vertex attributes. No higher level APIs are provided to set the depth of 2D graphics such as shapes, lines, and Images. love.graphics.setDepthMode( comparemode, write ) comparemode CompareMode Depth comparison mode used for depth testing. write boolean Whether to write update / write values to the depth buffer when rendering. love.graphics.setDepthMode()
love2d-community.github.io/love-api
love.graphics.setFont
love.graphics.setFont Set an already-loaded Font as the current font or create and load a new one from the file and size. It's recommended that Font objects are created with love.graphics.newFont in the loading stage and then passed to this function in the drawing stage. love.graphics.setFont( font ) font Font The Font object to use.
love2d-community.github.io/love-api
love.graphics.setFrontFaceWinding
love.graphics.setFrontFaceWinding Sets whether triangles with clockwise- or counterclockwise-ordered vertices are considered front-facing. This is designed for use in combination with Mesh face culling. Other love.graphics shapes, lines, and sprites are not guaranteed to have a specific winding order to their internal vertices. love.graphics.setFrontFaceWinding( winding ) winding VertexWinding The winding mode to use. The default winding is counterclockwise ('ccw').
love2d-community.github.io/love-api
love.graphics.setLineJoin
love.graphics.setLineJoin Sets the line join style. See LineJoin for the possible options. love.graphics.setLineJoin( join ) join LineJoin The LineJoin to use.
love2d-community.github.io/love-api
love.graphics.setLineStyle
love.graphics.setLineStyle Sets the line style. love.graphics.setLineStyle( style ) style LineStyle The LineStyle to use. Line styles include smooth and rough.
love2d-community.github.io/love-api
love.graphics.setLineWidth
love.graphics.setLineWidth Sets the line width. love.graphics.setLineWidth( width ) width number The width of the line.
love2d-community.github.io/love-api
love.graphics.setMeshCullMode
love.graphics.setMeshCullMode Sets whether back-facing triangles in a Mesh are culled. This is designed for use with low level custom hardware-accelerated 3D rendering via custom vertex attributes on Meshes, custom vertex shaders, and depth testing with a depth buffer. By default, both front- and back-facing triangles in Meshes are rendered. love.graphics.setMeshCullMode( mode ) mode CullMode The Mesh face culling mode to use (whether to render everything, cull back-facing triangles, or cull front-facing triangles).
love2d-community.github.io/love-api
love.graphics.setNewFont
love.graphics.setNewFont Creates and sets a new Font. font = love.graphics.setNewFont( size ) size (12) number The size of the font. font Font The new font. font = love.graphics.setNewFont( filename, size ) filename string The path and name of the file with the font. size (12) number The size of the font. font Font The new font. font = love.graphics.setNewFont( file, size ) file File A File with the font. size (12) number The size of the font. font Font The new font. font = love.graphics.setNewFont( data, size ) data Data A Data with the font. size (12) number The size of the font. font Font The new font. font = love.graphics.setNewFont( rasterizer ) rasterizer Rasterizer A rasterizer. font Font The new font.
love2d-community.github.io/love-api
love.graphics.setPointSize
love.graphics.setPointSize Sets the point size. love.graphics.setPointSize( size ) size number The new point size.
love2d-community.github.io/love-api
love.graphics.setScissor
love.graphics.setScissor Sets or disables scissor. The scissor limits the drawing area to a specified rectangle. This affects all graphics calls, including love.graphics.clear. The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). love.graphics.setScissor( x, y, width, height ) x number x coordinate of upper left corner. y number y coordinate of upper left corner. width number width of clipping rectangle. height number height of clipping rectangle. love.graphics.setScissor()
love2d-community.github.io/love-api
love.graphics.setShader
love.graphics.setShader Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next ''love.graphics.setShader'' will be drawn using the Shader object specified. love.graphics.setShader( shader ) shader Shader The new shader. love.graphics.setShader()
love2d-community.github.io/love-api
love.graphics.setStencilTest
love.graphics.setStencilTest Configures or disables stencil testing. When stencil testing is enabled, the geometry of everything that is drawn afterward will be clipped / stencilled out based on a comparison between the arguments of this function and the stencil value of each pixel that the geometry touches. The stencil values of pixels are affected via love.graphics.stencil. love.graphics.setStencilTest( comparemode, comparevalue ) comparemode CompareMode The type of comparison to make for each pixel. comparevalue number The value to use when comparing with the stencil value of each pixel. Must be between 0 and 255. love.graphics.setStencilTest()
love2d-community.github.io/love-api
love.graphics.setWireframe
love.graphics.setWireframe Sets whether wireframe lines will be used when drawing. love.graphics.setWireframe( enable ) enable boolean True to enable wireframe mode when drawing, false to disable it.
love2d-community.github.io/love-api