Game Development Reference
In-Depth Information
love.keyreleased ( key )
This function is called when a key that was pressed is released. This function acts as a handler for
the key-release event and is passed the key code. A complete reference of the key codes can be
found at https://love2d.org/wiki/KeyConstant .
love.focus ( )
This function is called when the user clicks on or off (any other window or desktop) the LÖVE
window. This is most useful for determining if the game is in the current window or not; if it isn't, then
The LÖVE system has several namespaces, each of which has functions. The functions described in
the preceding section are part of the global love namespace and hence are prefixed with love . The
other namespaces are described in this section.
love.audio
This namespace provides an interface to output sound from the speakers. This namespace plays
the actual sounds. All functionality associated with audio processing can be found here, including
changing the volume, playing, pausing, and stopping the sound.
love.event
This namespace manages events, as we learnt earlier. All events (e.g., keypresses, mouse clicks,
etc.) are part of the love.event namespace.
The event queue is used by the application to communicate within the application. This is similar to
the event dispatcher and the event listener.
-- Using an event queue
function love.keypressed(k)
if k == 'escape' then
love.event.push('quit') -- Quit the game
-- In LÖVE 7.0, you would only push 'q' to the event queue
end
 
Search WWH ::




Custom Search