Methods






Draw.captureObject(object: Object, mode: "none", : unknown)

Modes: none

  • none: Creates a canvas based on object size and draws the object at 0,0 (not transformed)

Arguments:

object: Object
mode: "none"
: unknown

Returns:

1: love.Canvas


Draw.draw(: unknown)

Arguments:

: unknown




Draw.drawCanvasPart(canvas: love.Canvas, x: number, y: number, cx: number, cy: number, cw: number, ch: number, r: number?, sx: number?, sy: number?, ox: number?, oy: number?, kx: number?, ky: number?)

@param canvas — The canvas to cut out.

@param x — The position to draw the cut-out texture (x-axis).

@param y — The position to draw the cut-out texture (y-axis).

@param cx — X position of the cut-out rectangle.

@param cy — Y position of the cut-out rectangle.

@param cw — Width of the cut-out rectangle.

@param ch — Height of the cut-out rectangle.

@param r — Orientation (radians).

@param sx — Scale factor (x-axis).

@param sy — Scale factor (y-axis).

@param ox — Origin offset (x-axis).

@param oy — Origin offset (y-axis).

@param kx — Shearing factor (x-axis).

@param ky — Shearing factor (y-axis).

Arguments:

canvas: love.Canvas

The canvas to cut out.

x: number

The position to draw the cut-out texture (x-axis).

y: number

The position to draw the cut-out texture (y-axis).

cx: number

X position of the cut-out rectangle.

cy: number

Y position of the cut-out rectangle.

cw: number

Width of the cut-out rectangle.

ch: number

Height of the cut-out rectangle.

r: number?

Orientation (radians).

sx: number?

Scale factor (x-axis).

sy: number?

Scale factor (y-axis).

ox: number?

Origin offset (x-axis).

oy: number?

Origin offset (y-axis).

kx: number?

Shearing factor (x-axis).

ky: number?

Shearing factor (y-axis).



Draw.drawPart(texture: love.Texture, x: number, y: number, cx: number, cy: number, cw: number, ch: number, r: number?, sx: number?, sy: number?, ox: number?, oy: number?, kx: number?, ky: number?)

@param texture — The texture to cut out.

@param x — The position to draw the cut-out texture (x-axis).

@param y — The position to draw the cut-out texture (y-axis).

@param cx — X position of the cut-out rectangle.

@param cy — Y position of the cut-out rectangle.

@param cw — Width of the cut-out rectangle.

@param ch — Height of the cut-out rectangle.

@param r — Orientation (radians).

@param sx — Scale factor (x-axis).

@param sy — Scale factor (y-axis).

@param ox — Origin offset (x-axis).

@param oy — Origin offset (y-axis).

@param kx — Shearing factor (x-axis).

@param ky — Shearing factor (y-axis).

Arguments:

texture: love.Texture

The texture to cut out.

x: number

The position to draw the cut-out texture (x-axis).

y: number

The position to draw the cut-out texture (y-axis).

cx: number

X position of the cut-out rectangle.

cy: number

Y position of the cut-out rectangle.

cw: number

Width of the cut-out rectangle.

ch: number

Height of the cut-out rectangle.

r: number?

Orientation (radians).

sx: number?

Scale factor (x-axis).

sy: number?

Scale factor (y-axis).

ox: number?

Origin offset (x-axis).

oy: number?

Origin offset (y-axis).

kx: number?

Shearing factor (x-axis).

ky: number?

Shearing factor (y-axis).



Draw.drawWrapped(drawable: love.Canvas|love.Texture, wrap_x: boolean?, wrap_y: boolean?, x: number?, y: number?, r: number?, sx: number?, sy: number?, ox: number?, oy: number?, kx: number?, ky: number?)

@param drawable — The texture to draw wrapped.

@param wrap_x — Whether the image will repeat along the x-axis.

@param wrap_y — Whether the image will repeat along the y-axis.

@param x — The position to draw the texture (x-axis).

@param y — The position to draw the texture (y-axis).

@param r — Orientation (radians).

@param sx — Scale factor (x-axis).

@param sy — Scale factor (y-axis).

@param ox — Origin offset (x-axis).

@param oy — Origin offset (y-axis).

@param kx — Shearing factor (x-axis).

@param ky — Shearing factor (y-axis).

Arguments:

drawable: love.Canvas|love.Texture

The texture to draw wrapped.

wrap_x: boolean?

Whether the image will repeat along the x-axis.

wrap_y: boolean?

Whether the image will repeat along the y-axis.

x: number?

The position to draw the texture (x-axis).

y: number?

The position to draw the texture (y-axis).

r: number?

Orientation (radians).

sx: number?

Scale factor (x-axis).

sy: number?

Scale factor (y-axis).

ox: number?

Origin offset (x-axis).

oy: number?

Origin offset (y-axis).

kx: number?

Shearing factor (x-axis).

ky: number?

Shearing factor (y-axis).





Draw.popCanvas(keep: boolean?)

Arguments:

keep: boolean?

Returns:

1: love.Canvas








Draw.printShadow(text: string|table, x: number?, y: number?, offset: number?, align: (love.AlignMode)?, limit: number?)

Draws text with a black drop shadow behind it.

-- 
-- Text alignment.
-- 
-- 
-- [Open in Browser](https://love2d.org/wiki/AlignMode)
-- 
align:
    | "center" -- Align text center.
    | "left" -- Align text left.
    | "right" -- Align text right.
    | "justify" -- Align text both left and right.

Arguments:

text: string|table

A text string, or table of color-formatted text.

x: number?

The position on the x-axis.

y: number?

The position on the y-axis.

offset: number?

The offset of the drop shadow. (Defaults to 2)

align: (love.AlignMode)?

The alignment.

limit: number?

Wrap the line after this many horizontal pixels.









Draw.pushShader(shader: string|love.Shader, vars: any)

Arguments:

shader: string|love.Shader

A Shader is used for advanced hardware-accelerated pixel or vertex manipulation. These effects are written in a language based on GLSL (OpenGL Shading Language) with a few things simplified for easier coding.

Potential uses for shaders include HDR/bloom, motion blur, grayscale/invert/sepia/any kind of color effect, reflection/refraction, distortions, bump mapping, and much more! Here is a collection of basic shaders and good starting point to learn: https://github.com/vrld/moonshine

Open in Browser

vars: any

Returns:

1: love.Shader


Draw.rectangle(type: any, x: any, y: any, width: any, height: any)

Arguments:

type: any
x: any
y: any
width: any
height: any


Draw.scissor(x: number, y: number, w: number, h: number)

Arguments:

x: number
y: number
w: number
h: number


Draw.scissorPoints(x1: number?, y1: number?, x2: number?, y2: number?)

Arguments:

x1: number?
y1: number?
x2: number?
y2: number?


Draw.setCanvas(canvas: (love.Canvas)?, options: boolean }?)

Arguments:

canvas: (love.Canvas)?

A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".

By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.

In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.

Open in Browser

options: boolean }?


Draw.setColor(r: number?, g: number?, b: number?, a: number?)

Arguments:

r: number?
g: number?
b: number?
a: number?


Draw.unlockCanvas(canvas: love.Canvas)

Arguments:

canvas: love.Canvas

A Canvas is used for off-screen rendering. Think of it as an invisible screen that you can draw to, but that will not be visible until you draw it to the actual visible screen. It is also known as "render to texture".

By drawing things that do not change position often (such as background items) to the Canvas, and then drawing the entire Canvas instead of each item, you can reduce the number of draw operations performed each frame.

In versions prior to love.graphics.isSupported("canvas") could be used to check for support at runtime.

Open in Browser




Fields










Undocumented