- love
- love.system
- love.graphics
- love.timer
- love.keyboard
- love.mouse
- love.filesystem
- love.audio
- love.event
Returns the version of LoveDOS as a string.
Provides access to information about the user's system.
Returns the operating system which LoveDOS is running on.
Returns the amount of memory in kilobytes which is being used by LoveDOS. This includes the memory used by both the loaded assets and lua.
Provides functions for drawing lines, shapes, text and images.
Returns the width and height of the screen in pixels as two numbers.
Returns the width of the screen in pixels.
Returns the height of the screen in pixels.
Returns the currently set background color.
Sets the the background color used when love.graphics.clear()
is called
without any arguments. If called with no arguments the back color is set to
black.
Returns the currently set color.
Sets the the color used when drawing. If called with no arguments the color is set to white.
Returns the currently set blend mode.
Sets the current blend mode used by love.graphics.draw()
. If no mode
argument is passed then the blend mode is set to the default ("normal"
).
Mode | Description |
---|---|
"normal" |
Draws normally with transparency |
"fast" |
Draws without transparency, this is the fastest blend mode |
"and" |
Binary ANDs the source and destination pixels |
"or" |
Binary ORs the source and destination pixels |
"color" |
Draws opaque pixels using the love.graphics.setColor() color |
Returns the current font.
Sets the current font. If font
is nil then the font is reset to the default.
Returns the current canvas.
Sets the current canvas which all the draw operations will draw to. If the
image
argument is not set then the canvas is reset to the default canvas
representing the user's screen.
Resets the font, color, background color, canvas, blend mode and flip mode to their defaults.
Clears the screen (or canvas) to the color. If no color argument is given
then the background color is used (see love.graphics.setBackgroundColor()
).
Draws the image
to the screen at the given x
, y
position. If a quad
argument is provided then the image is clipped to the provided quad when drawn.
If flip
is true then the image is flipped horizontally.
Draws a pixel.
Draws a line from the positition x
, y
to x2
, y2
. You can continue
passing point positions to draw a polyline.
Draws a rectange and the x
, y
position of the given width
and height
.
mode
should be either "fill"
or "line"
.
Draws a circle of a given radius
with its center at the x
, y
position.
mode
should be either "fill"
or "line"
.
Draws the text
string in the current font with its top left at the x
, y
position.
Creates and returns a new image. filename
should be the name of an image file.
LoveDOS is limited to a palette of 255 unique colors in any given game; it is up
to the user not to exceed this limit.
Creates and returns a new blank image of the size width
, height
. If a
width
and height
are not provided then the image will be the same
dimensions as the screen.
Creates and returns a new quad.
Creates and returns a new font. filename
should be the name of a ttf file and
ptsize
its size. If no filename
is provided the built in font is used.
Flips the current screen buffer with the displayed screen buffer. This is
called automatically after the love.draw()
callback.
Provides an interface to your system's clock.
Returns the time between the last two frames.
Returns the average delta time over the last second.
Returns the current frames per second
Returns the number of seconds since some time in the past. The value returned by this function should be used only as a comparison with other values returned by this function.
Measures the time between two frames. This is automatically called each frame.
Pauses the thread for the specified number of seconds
. During this time no
callbacks are called.
Returns true if any of the given keys are currently pressed.
Dictates whether repeat keypressed
events should occur if a key is held down.
By default this is false
.
Returns 2 values: the current horizontal and vertical position of the mouse.
Returns the horizontal position of the mouse.
Returns the vertical position of the mouse.
Returns true if any of the given mouse buttons are currently pressed. button
should be the value 1
(left), 2
(right) or 3
(middle).
Mounts the given path. path
should be either a directory or tar archive.
Returns nil
and an error message on failure.
Unmounts the given path
. Returns nil
and an error message on failure.
Returns true
if the given path exists.
Returns true
if filename
is a file.
Returns true
if dir
is a directory.
Reads and returns the contents of the file at filename
.
Writes string
to the given filename
in the game's save directory.
Creates and returns a new audio source. filename
should the filename of the
.wav
file to load.
Sets the master volume, by default this is 1
.
Pushes the quit
event with the given status
. status
is 0
by default.
A loaded image or canvas which can be drawn.
Returns the width and height of the image in pixels as two numbers.
Returns the width in pixels of the image.
Returns the height in pixels of the image.
Returns the color of the pixel at the position x
, y
of the image. If the
position is out of bounds or the pixel is set to transparent then nil
is
returned.
Sets the pixel of the image at position x
, y
to the given color; if no color
is provided the pixel is set to transparent. If the position is out of bounds
then no change is made.
A rectangle used to represent the clipping region of an image when drawing.
Sets the position and dimensions of the quad
Returns the position (x
, y
) and dimensions (width
, height
) of the quad,
4 numerical values in total.
A font used by love.graphics.print()
. The current font can be set using the
love.graphics.setFont()
function.
Returns the width in pixels that the text
string would take when printed using
this font.
Returns the height of the font in pixels.
Sets the volume -- by default this is 1
.
Sets the pitch (playback speed). By default this is 1
. 0.5
is half the
pitch, 2
is double the pitch.
Enables looping if enable
is true
. By default looping is disabled.
Gets the length in seconds of the source's audio data.
Returns true
if the source is currently playing.
Returns true
if the source is currently paused.
Returns true
if the source is currently stopped.
Returns the current playback position in seconds.
Plays the audio source. If the source is already playing then this function has
no effect. To play back from the start call Source:stop()
before calling this
function.
Pauses the source's playback. This stops playback without losing the current position, calling Source:play()
will continue playing where it left off.
Stops playing and rewinds the source's play position back to the beginning.
Called when LoveDOS is started. args
is a table containing the command line
arguments passed to LoveDOS.
Called at the beginning of each frame, dt
is the amount of time in seconds
which has passed since the last frame. This is where all the game logic should
take place.
Called when the frame is ready to be drawn. All your draw calls should take place in this function.
Called when the user presses a key. key
is the key that was pressed, code
is
the scancode of the pressed key, isrepeat
is true if this key press event is a
repeat.
Called when the user releases a key. key
is the key that was released, code
is the scancode for the released key.
Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text "@" will be generated.
Called when the user moves the mouse. x
and y
are the mouse's current
position, dx
and dy
is the amount moved relative to the last mouse position.
Called when the user presses a mouse button. x
and y
are the mouse's current
position. button
is the value 1
(left), 2
(right) or 3
(middle).
Called when the user releases a mouse button. x
and y
are the mouse's
current position. button
is the value 1
(left), 2
(right) or 3
(middle).
Called when an unprotected error occurs; err
is the error message. By default
this function displays the error message and stacktrace on screen and waits for
the escape
key to be pressed before exiting.