DrawManager

For drawing primitives like rectangles and lines.

About

Being able to draw a rectangle, line, or single pixel from any place is useful for debugging or things like fading the screen out.

You can specify which layer to draw over and whether or not to use screen or world coordinates.

Usage

//draw a black line on the screen, on top of everything else
GetDrawManager:DrawLine(Vector2(0,0), Vector2(100,100), Color(0,0,0,255), C_LAYER_TOP, C_DRAW_SCREEN_COORDS);
Summary
DrawManagerFor drawing primitives like rectangles and lines.
Member Functions
DrawLine
DrawPixel
DrawRect
DrawFilledRect
Related Constants
C_DRAW_TYPE_CONSTANTSUsed with the DrawManager
C_DRAW_SCREEN_COORDSThe numbers passed in are in screen coordinates, so 0,0 would always mean the upper-left most dot on the screen.
C_DRAW_WORLD_COORDSThe numbers passed in are in world coordinates, drawing a dot at an entities position would draw it over wherever the entity is, possibly offscreen.

Member Functions

DrawLine

nil DrawLine(Vector2 a, Vector2 b, Color col, number layerID, number drawType)

Draws a line of the specified color at the specified layerID.

Parameters

aA Vector2 object containing the line’s starting position
bA Vector2 object containing the line’s ending position
colA Color object that specifies the line’s color and opacity
layerIDOnto which layer we should draw to, use C_LAYER_TOP for on top of everything
drawTypeOne of the C_DRAW_TYPE_CONSTANTS.

DrawPixel

nil DrawPixel(Vector2 vPos, Color col, number layerID, number drawType)

Draws a pixel of the specified color at the specified layerID.

Parameters

vPosA Vector2 object containing the location of the pixel
colA Color object that specifies the line’s color and opacity
layerIDOnto which layer we should draw to, use C_LAYER_TOP for on top of everything
drawTypeOne of the C_DRAW_TYPE_CONSTANTS.

DrawRect

nil DrawRect(Rectf area, Color col, number layerID, number drawType)

Draws a rectangle outline of the specified color at the specified layerID.

Parameters

areaA Rectf object containing the coordinates of the rect
colA Color object that specifies the line’s color and opacity
layerIDOnto which layer we should draw to, use C_LAYER_TOP for on top of everything
drawTypeOne of the C_DRAW_TYPE_CONSTANTS.

DrawFilledRect

nil DrawFilledRect(Rectf area, Color col, number layerID, number drawType)

Draws a filled rectangle of the specified color at the specified layerID.

Parameters

areaA Rectf object containing the coordinates of the rect
colA Color object that specifies the line’s color and opacity
layerIDOnto which layer we should draw to, use C_LAYER_TOP for on top of everything
drawTypeOne of the C_DRAW_TYPE_CONSTANTS.

Related Constants

Summary
C_DRAW_TYPE_CONSTANTSUsed with the DrawManager
C_DRAW_SCREEN_COORDSThe numbers passed in are in screen coordinates, so 0,0 would always mean the upper-left most dot on the screen.
C_DRAW_WORLD_COORDSThe numbers passed in are in world coordinates, drawing a dot at an entities position would draw it over wherever the entity is, possibly offscreen.

C_DRAW_TYPE_CONSTANTS

Used with the DrawManager

C_DRAW_SCREEN_COORDS

The numbers passed in are in screen coordinates, so 0,0 would always mean the upper-left most dot on the screen.

C_DRAW_WORLD_COORDS

The numbers passed in are in world coordinates, drawing a dot at an entities position would draw it over wherever the entity is, possibly offscreen.

For drawing primitives like rectangles and lines.
The Vector2 object.
The color object stores R G B A color information.
Used with the DrawManager
The Rectf object.