Views
love
The root module which contains all the other modules. Clearly the loveliest module of all.
When beginning to write games using LÖVE, the most important parts of the API are the callbacks: love.load to do one-time setup of your game, love.update which is used to manage your game's state frame-to-frame, and love.draw which is used to render the game state onto the screen.
More interactive games will override additional callbacks in order to handle input from the user, and other aspects of a full-featured game.
LÖVE provides default placeholders for these callbacks, which you can override inside your own code, simply by specifying their fully qualified name:
function love.load()
hamster = love.graphics.newImage("hamster.png")
x = 50
y = 50
end
function love.draw()
love.graphics.draw(hamster, x, y)
end
hamster = love.graphics.newImage("hamster.png")
x = 50
y = 50
end
function love.draw()
love.graphics.draw(hamster, x, y)
end
Modules
love.audio | Provides an interface to create noise with the user's speakers. |
love.event | Manages events, like keypresses. |
love.filesystem | Provides an interface to the user's filesystem. |
love.font | Allows you to work with fonts. |
love.graphics | Drawing of shapes and images, management of screen geometry. |
love.image | Provides an interface to decode encoded image data. |
love.joystick | Provides an interface to the user's joystick. |
love.keyboard | Provides an interface to the user's keyboard. |
love.mouse | Provides an interface to the user's mouse. |
love.physics | Can simulate 2D rigid body physics in a realistic manner. |
love.sound | This module is responsible for decoding sound files. |
love.thread | Allows you to work with threads. |
love.timer | Provides an interface to the user's clock. |
Types
Data | The superclass of all data. |
Object | The superclass of all LÖVE types. |
Callbacks
love.draw | Callback function used to draw on the screen every frame. |
love.focus | Callback function triggered when window receives or loses focus. |
love.joystickpressed | Called when a joystick button is pressed. |
love.joystickreleased | Called when a joystick button is released. |
love.keypressed | Callback function triggered when a key is pressed. |
love.keyreleased | Callback function triggered when a key is released. |
love.load | This function is called exactly once at the beginning of the game. |
love.mousepressed | Callback function triggered when a mouse button is pressed. |
love.mousereleased | Callback function triggered when a mouse button is released. |
love.quit | Callback function triggered when the game is closed. |
love.run | The main function, containing the main loop. A sensible default is used when left out. |
love.update | Callback function used to update the state of the game every frame. |