love.graphics

The primary responsibility for the love.graphics module is the drawing of lines, shapes, text, Images and other Drawable objects onto the screen. Its secondary responsibilities include loading external files (including Images and Fonts) into memory, creating specialized objects (such as ParticleSystems or Canvases) and managing screen geometry.

LÖVE's coordinate system is rooted in the upper-left corner of the screen, which is at location (0, 0). The x axis is horizontal: larger values are further to the right. The y axis is vertical: larger values are further towards the bottom.

The LÖVE coordinate system

In many cases, you draw images or shapes in terms of their upper-left corner (See the picture above).

Many of the functions are used to manipulate the graphics coordinate system, which is essentially the way coordinates are mapped to the display. You can change the position, scale, and even rotation in this way.


Types

CanvasOff-screen render target.Added since 0.8.0
DrawableSuperclass for all things that can be drawn on screen.
FontDefines the shape of characters than can be drawn onto the screen.
FramebufferOff-screen render target.Added since 0.7.0 Removed in 0.8.0
ImageDrawable image type.
MeshA 2D polygon mesh used for drawing arbitrary textured shapes.Added since 0.9.0
ParticleSystemUsed to create cool effects, like fire.
PixelEffectPixel shader effect.Added since 0.8.0 Removed in 0.9.0
QuadA quadrilateral with texture coordinate information.
ShaderShader effect.Added since 0.9.0
SpriteBatchStore image positions in a buffer, and draw it in one call.
TextureSuperclass for drawable objects which represent a texture.Added since 0.9.1

Functions

Drawing

love.graphics.arcDraws an arc.Added since 0.8.0
love.graphics.circleDraws a circle.
love.graphics.clearClears the screen to background color.
love.graphics.drawDraws objects on screen.
love.graphics.drawqDraw a Quad with the specified Image on screen. Removed in 0.9.0
love.graphics.lineDraws lines between points.
love.graphics.pointDraws a point.
love.graphics.polygonDraw a polygon.
love.graphics.presentDisplays the results of drawing operations on the screen.
love.graphics.printDraws text on screen. If no Font is set, one will be created and set (once) if needed.
love.graphics.printfDraws formatted text, with word wrap and alignment.
love.graphics.quadDraws a quadrilateral shape. Removed in 0.9.0
love.graphics.rectangleDraws a rectangle.
love.graphics.triangleDraws a triangle. Removed in 0.9.0

Object Creation

love.graphics.newCanvasCreates a new Canvas.Added since 0.8.0
love.graphics.newFontCreates a new Font.
love.graphics.newFramebufferCreates a new Framebuffer.Added since 0.7.0 Removed in 0.8.0
love.graphics.newImageCreates a new Image.
love.graphics.newImageFontCreates a new Font by loading a specifically formatted image.Added since 0.2.0
love.graphics.newMeshCreates a new Mesh.Added since 0.9.0
love.graphics.newParticleSystemCreates a new ParticleSystem.
love.graphics.newPixelEffectCreates a new PixelEffect.Added since 0.8.0 Removed in 0.9.0
love.graphics.newQuadCreates a new Quad.
love.graphics.newScreenshotCreates a screenshot and returns the ImageData.
love.graphics.newShaderCreates a new Shader.Added since 0.9.0
love.graphics.newSpriteBatchCreates a new SpriteBatch.
love.graphics.newStencilCreates a new stencil.Added since 0.8.0 Removed in 0.9.0
love.graphics.setNewFontCreates and sets a new Font.Added since 0.8.0

Graphics State

love.graphics.getBackgroundColorGets the current background color.
love.graphics.getBlendModeGets the blending mode.Added since 0.2.0
love.graphics.getCanvasReturns the current target Canvas.Added since 0.8.0
love.graphics.getColorGets the current color.
love.graphics.getColorMaskGets the active color components used when drawing.Added since 0.9.0
love.graphics.getColorModeGets the color mode (which controls how images are affected by the current color).Added since 0.2.0 Removed in 0.9.0
love.graphics.getDefaultFilterReturns the default scaling filters used with Images, Canvases, and Fonts.Added since 0.9.0
love.graphics.getDefaultImageFilterReturns the default scaling filters.Added since 0.8.0 Removed in 0.9.0
love.graphics.getFontGets the current Font object.
love.graphics.getLineJoinGets the line join style.
love.graphics.getLineStippleGets the current line stipple. Removed in 0.8.0
love.graphics.getLineStyleGets the line style.
love.graphics.getLineWidthGets the current line width.
love.graphics.getMaxImageSizeGets the max supported width or height of Images and Canvases.Added since 0.9.0
love.graphics.getMaxPointSizeGets the max supported point size.
love.graphics.getPixelEffectReturns the current PixelEffect.Added since 0.8.0 Removed in 0.9.0
love.graphics.getPointSizeGets the point size.
love.graphics.getPointStyleGets the current point style.
love.graphics.getRendererInfoGets information about the system's video card and drivers.Added since 0.9.0
love.graphics.getScissorGets the current scissor box.Added since 0.4.0
love.graphics.getShaderGets the current Shader.Added since 0.9.0
love.graphics.getSystemLimitGets the system-dependent maximum value for a love.graphics feature.Added since 0.9.1
love.graphics.isSupportedChecks for the support of graphics related functions.Added since 0.8.0
love.graphics.isWireframeGets whether wireframe mode is used when drawing.Added since 0.9.1
love.graphics.resetResets the current graphics settings.
love.graphics.setBackgroundColorSets the background color.
love.graphics.setBlendModeSets the blending mode.Added since 0.2.0
love.graphics.setCanvasCaptures drawing operations to a CanvasAdded since 0.8.0
love.graphics.setColorSets the color used for drawing.
love.graphics.setColorMaskSets the color mask. Enables or disables specific color components when rendering.Added since 0.9.0
love.graphics.setColorModeSets the color mode (which controls how images are affected by the current color).Added since 0.2.0 Removed in 0.9.0
love.graphics.setDefaultFilterSets the default scaling filters used with Images, Canvases, and Fonts.Added since 0.9.0
love.graphics.setDefaultImageFilterSets the default scaling filters.Added since 0.8.0 Removed in 0.9.0
love.graphics.setFontSet an already-loaded Font as the current font.
love.graphics.setInvertedStencilDefines an inverted stencil.Added since 0.8.0
love.graphics.setLineSets the line width and style. Removed in 0.9.0
love.graphics.setLineJoinSets the line join style.
love.graphics.setLineStippleSets the line stipple pattern. Removed in 0.8.0
love.graphics.setLineStyleSets the line style.
love.graphics.setLineWidthSets the line width.
love.graphics.setPixelEffectRoutes drawing operations through a pixel shader.Added since 0.8.0 Removed in 0.9.0
love.graphics.setPointSets the point size and style. Removed in 0.9.0
love.graphics.setPointSizeSets the point size.
love.graphics.setPointStyleSets the point style.
love.graphics.setRenderTargetCaptures drawing operations to a FramebufferAdded since 0.7.0 Removed in 0.8.0
love.graphics.setScissorSets or disables scissor.Added since 0.4.0
love.graphics.setShaderRoutes drawing operations through a shader.Added since 0.9.0
love.graphics.setStencilDefines or releases a stencil.Added since 0.8.0
love.graphics.setWireframeSets whether wireframe lines will be used when drawing.Added since 0.9.1

Coordinate System

love.graphics.originResets the current coordinate transformation.Added since 0.9.0
love.graphics.popPops the current coordinate transformation from the transformation stack.
love.graphics.pushCopies and pushes the current coordinate transformation to the transformation stack.
love.graphics.rotateRotates the coordinate system in two dimensions.
love.graphics.scaleScales the coordinate system in two dimensions.
love.graphics.shearShears the coordinate system.Added since 0.8.0
love.graphics.translateTranslates the coordinate system in two dimensions.

Window

love.graphics.checkModeChecks if a display mode is supported. Removed in 0.9.0
love.graphics.getCaptionGets the window caption. Removed in 0.9.0
love.graphics.getDimensionsGets the width and height of the window.Added since 0.9.0
love.graphics.getHeightGets the height in pixels of the window.Added since 0.2.1
love.graphics.getModeReturns the current display mode.Added since 0.8.0 Removed in 0.9.0
love.graphics.getModesGets a list of supported fullscreen modes. Removed in 0.9.0
love.graphics.getWidthGets the width in pixels of the window.Added since 0.2.1
love.graphics.hasFocusChecks if the game window has keyboard focus.Added since 0.8.0 Removed in 0.9.0
love.graphics.isCreatedChecks if the display has been set. Removed in 0.9.0
love.graphics.setCaptionSets the window caption. Removed in 0.9.0
love.graphics.setIconSet window icon.Added since 0.7.0 Removed in 0.9.0
love.graphics.setModeChanges the display mode. Removed in 0.9.0
love.graphics.toggleFullscreenToggles fullscreen. Removed in 0.9.0

Enums

AlignModeText alignment.
BlendModeDifferent ways you do alpha blending.Added since 0.2.0
ColorModeControls how drawn images are affected by current color.Added since 0.2.0 Removed in 0.9.0
DrawModeControls whether shapes are drawn as an outline, or filled.
FilterModeHow the image is filtered when scaling.
GraphicsFeatureGraphics features that can be checked for with love.graphics.isSupported.Added since 0.8.0
GraphicsLimitTypes of system-dependent graphics limits.Added since 0.9.1
LineJoinLine join style.
LineStyleThe styles in which lines are drawn.
MeshDrawModeHow a Mesh's vertices are used when drawing.Added since 0.9.0
PointStyleHow points should be drawn.
SpriteBatchUsageUsage hints for SpriteBatches.Added since 0.8.0
TextureFormatControls the canvas texture format.Added since 0.9.0
WrapModeHow the image wraps inside a large Quad.

See Also

Other Languages

Personal tools