libraries/love.nv
rules
close game window
snippet
love.event.quit(0)
get mouse position
mouse x
OldX
mouse y
OldY
mouse x
X
mouse y
Y
snippet
local X, Y = love.mouse.getPosition()
get mouse position
mouse x
X
mouse y
Y
snippet
local X, Y = love.mouse.getPosition()
hide cursor
snippet
love.mouse.setVisible(false)
set line width to Width
snippet
love.graphics.setLineWidth(Width)
set color to R G B
snippet
love.graphics.setColor(R, G, B)
set color to R G B A
snippet
love.graphics.setColor(R, G, B, A)
draw rectangle Width by Height at X Y
snippet
love.graphics.rectangle('fill', X, Y, Width, Height)
draw line from X1 Y1 to X2 Y2
snippet
love.graphics.line(X1, Y1, X2, Y2)
draw circle size Size at X Y
snippet
love.graphics.circle('fill', X, Y, Size)
draw circle outline size Size at X Y
snippet
love.graphics.circle('line', X, Y, Size)
set line width to Width
snippet
love.graphics.setLineWidth(Width)
draw text Text at X Y
snippet
love.graphics.print(Text, X, Y)
draw centered text Text at X Y
snippet
local font = love.graphics.getFont()
local x = X - font:getWidth(Text) / 2
local y = Y - font:getHeight(Text) / 2
love.graphics.print(Text, x, y)
draw fps at X Y
snippet
local fps = 'FPS: '.. love.timer.getFPS()
love.graphics.print(fps, X, Y)
set background color to R G B
snippet
love.graphics.setBackgroundColor(R, G, B)
set font size to Size
snippet
local font = love.graphics.newFont(tonumber(Size))
love.graphics.setFont(font)
create font Path size Size
snippet
f('result', {love.graphics.newFont(Path, tonumber(Size))})
set font to Font name
Font name
Font
snippet
love.graphics.setFont(Font)
move mouse cursor to X Y
snippet
love.mouse.setPosition(X, Y)
get mouse press
snippet
local x, y = love.mouse.getPosition()
if love.mouse.isDown(1) then
f('', {'mouse', 'left', 'pressed', 'at', x, y})
elseif love.mouse.isDown(2) then
f('', {'mouse', 'right', 'pressed', 'at', x, y})
end
get key press
snippet
function love.keypressed(key)
f('', {'pressed', 'key', key})
end
get screen dimensions
screen dimensions
Width Height
snippet
local Width = love.graphics.getWidth()
local Height = love.graphics.getHeight()
create sound Path Volume
create sound Path Volume 1
create sound Path Volume Pitch
snippet
local sound = love.audio.newSource(Path, 'static')
sound:setVolume(Volume)
sound:setPitch(Pitch)
f('result', {sound})
create song Path Volume
snippet
local song = love.audio.newSource(Path, 'stream')
song:setVolume(Volume)
song:setLooping(true)
f('result', {song})
loop sound Name
Name
Sound
snippet
Sound:setLooping(true)
play sound Name
Name
Sound
snippet
Sound:play()
stop sound Name
Name
Sound
snippet
Sound:stop()
play song Song
current song
Current
stop sound Current
play sound Song
current song
Song
play song Song
play sound Song
current song
Song
set pitch of Sound name to Pitch
Sound name
Sound
snippet
Sound:setPitch(Pitch)
set lowpass filter on Sound name to Amount
Sound name
Sound
snippet
Sound:setFilter({
type = 'lowpass',
highgain = Amount
})