Game Development Reference
In-Depth Information
There are several types of graphics objects that make up LÖVE:
Canvas
: This is the offscreen render target.
Drawable
: This comprises all the items that can be drawn.
Font
: The characters that can be drawn on the screen.
Framebuffer
: This is the offscreen render target.
Image
: This is the image that can be drawn.
ParticleSystem
: This is the particle system, which you can use to create
cool effects.
PixelEffect
: This is the pixel shader.
Quad
: This is a quadrilateral with texture information.
SpriteBatch
: This stores the geometry in a buffer for drawing later.
Images
We can load an image using the
newImage
function; however, to display them on the screen, the code
that does the drawing must be in the
love.draw
callback function. The code below will display the
output as seen in Figure
11-3
below.
local theImage, x, y
function love.load()
theImage = love.graphics.newImage("myImage.png")
x = 50
y = 50
end
function love.draw()
love.graphics.draw(theImage, x, y)
end