Lutro - Documentation

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 and managing screen geometry.

Lutro'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. It is worth noting that the location (0, 0) aligns with the upper-left corner of the pixel as well, meaning that for some functions you may encounter off-by-one problems in the render output when drawing 1 pixel wide lines.

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

love.graphics.clear

Clears the screen to the background color.

love.graphics.clear()

love.graphics.draw

Draws objects on screen. In Lutro, a Drawable is typically an Image.

love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky)

You can also draw a specified Quad from the texture:

love.graphics.draw(texture, quad, x, y, r, sx, sy, ox, oy, kx, ky)

love.graphics.newImage

Creates a new Image.

From an image file:

img = love.graphics.newImage("star.png")

From an ImageData:

img = love.graphics.newImage(imgData)

love.graphics.newImageFont

Creates a new Font by loading a specifically formatted image.

From an image file:

font = love.graphics.newImageFont("font.png", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

You can add an extra parameter to set the letter spacing:

font = love.graphics.newImageFont("font.png", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 0)

Note: Lutro defaults to 1 while LÖVE defaults to 0.

From an ImageData:

font = love.graphics.newImageFont(imgData, "ABCDEFGHIJKLMNOPQRSTUVWXYZ")

love.graphics.newQuad

love.graphics.newCanvas

love.graphics.print

Draws text on screen. A Font need to be set with setFont prior to use.

love.graphics.print(text, x, y)

love.graphics.printf

Draws formatted text, with word wrap and alignment. align can be "left", "center" or "right".

love.graphics.print(text, x, y, limit, align)

love.graphics.point

Draws a point.

love.graphics.point(x, y)

love.graphics.points

Draws one or more points.

love.graphics.points(x, y, ...)

love.graphics.line

Draws lines between points.

love.graphics.line(x1, y1, x2, y2, ...)

love.graphics.rectangle

Draws a rectangle. mode can be "fill" or "line".

love.graphics.rectangle(mode, x, y, width, height)

love.graphics.polygon

Draws a polygon. mode can be "fill" or "line".

love.graphics.polygon(mode, x1, y1, x2, y2, ...)

love.graphics.circle

love.graphics.ellipse

love.graphics.origin

love.graphics.pop

love.graphics.push

love.graphics.rotate

love.graphics.scale

love.graphics.translate

love.graphics.getBackgroundColor

love.graphics.setBackgroundColor

love.graphics.getColor

love.graphics.setColor

Sets the color used for drawing.

love.graphics.getFont

Returns the current Font.

love.graphics.setFont

Set an already-loaded Font as the current font.

love.graphics.getHeight

Returns the height of the libretro viewport.

love.graphics.getWidth

Returns the width of the libretro viewport.

love.graphics.getCanvas

love.graphics.setScissor

love.graphics.setCanvas