love module reference
love module reference
LÖVE graphics.
This module implements basic graphics using the love2d game engine.
running
In order to use this module, the copilot has to be started in a specific way:
$ love bin/alv-love <session.alv>
usage
The love/draw ops can be used to draw one or more love/shapes in a fixed
stacking order. love/shapes can be created using love/rectangle etc, and
positioned and styled using the modifier ops like love/translate,
love/color and so on. All modifier ops take the shape as the last input and
output a modified shape, and can be used comfortably with the thread-last
macro ->>:
(import* love math)
(draw (->>
(rectangle 'fill' 100 100)
(color 1 0 0)
(rotate (/ pi 4))
(translate 150 150)))
index
- create a circle shape.
- set color of a shape.
- draw one or more love/shape shapes.
- create a ellipse shape.
- create a font.
- checks whether a key is down.
- outputs key press events.
- outputs key release events.
- set line-width of a shape.
- outputs mouse move events.
- checks whether a mouse button is down.
- outputs current mouse position.
- outputs mouse press events.
- outputs mouse release events.
- invisible null shape.
- create a rectangle shape.
- rotate a shape.
- scale a shape.
- shear a shape.
- create a text shape.
- translate a shape.
- outputs mouse wheel move events.
details
- create a circle shape.
(love/circle mode radius [segments]) - set color of a shape.
(love/color color shape)(love/color r g b [a] shape) - draw one or more love/shape shapes.
(love/draw shape1 …)(love/draw shapes) - create a ellipse shape.
(love/ellipse mode size [segments])(love/ellipse mode rx ry [segments]) - create a font.
(love/font [filename] size) - checks whether a key is down.
(love/key-down? key)checks whether
keyis down and returns a bool ~-stream.keyshould be a str~ stream. - outputs key press events.
(love/key-presses)(love/key-presses key)With no arguments, outputs a str! stream of key names.
If
keyis passed, outputs a bang! stream. - outputs key release events.
(love/key-releases)(love/key-releases key)With no arguments, outputs a str! stream of key names.
If
keyis passed, outputs a bang! stream. - set line-width of a shape.
(love/line-width width shape) - outputs mouse move events.
(love/mouse-delta)vec2! stream of mouse movements.
- checks whether a mouse button is down.
(love/mouse-down? [button])checks whether
buttonis down and returns a bool ~-stream.buttonshould be a num~ stream and defaults to1(the left mouse button). - outputs current mouse position.
(love/mouse-pos)vec2~ stream of mouse position.
- outputs mouse press events.
(love/mouse-presses)(love/mouse-presses button)With no arguments, outputs a !-stream of press events with the following keys:
pos(vec2): x/y position of mousebutton(num): mouse button number
If
buttonis passed, outputs a vec2! stream. - outputs mouse release events.
(love/mouse-releases)(love/mouse-releases button)With no arguments, outputs a !-stream of release events with the following keys:
pos(vec2): x/y position of mousebutton(num): mouse button number
If
buttonis passed, outputs a vec2! stream. - invisible null shape.
- create a rectangle shape.
(love/rectangle mode size)(love/rectangle mode w h) - rotate a shape.
(love/rotate angle shape) - scale a shape.
(love/scale scale shape)(love/scale sx [sy] shape) - shear a shape.
(love/shear x y shape) - create a text shape.
(love/text str [align] [font])Create a shape that draws the text
strwith fontfont(or the default font).alignshould be on of the following strings:center(the default)leftright
- translate a shape.
(love/translate [delta] shape)(love/translate x y shape) - outputs mouse wheel move events.
(love/wheel-delta)vec2! stream of mouse wheel movements.