For drawing primitives like rectangles and lines.
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.
//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);
DrawManager | For drawing primitives like rectangles and lines. |
Member Functions | |
DrawLine | |
DrawPixel | |
DrawRect | |
DrawFilledRect | |
Related Constants | |
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. |
nil DrawLine(Vector2 a, Vector2 b, Color col, number layerID, number drawType)
Draws a line of the specified color at the specified layerID.
a | A Vector2 object containing the line’s starting position |
b | A Vector2 object containing the line’s ending position |
col | A Color object that specifies the line’s color and opacity |
layerID | Onto which layer we should draw to, use C_LAYER_TOP for on top of everything |
drawType | One of the C_DRAW_TYPE_CONSTANTS. |
nil DrawPixel(Vector2 vPos, Color col, number layerID, number drawType)
Draws a pixel of the specified color at the specified layerID.
vPos | A Vector2 object containing the location of the pixel |
col | A Color object that specifies the line’s color and opacity |
layerID | Onto which layer we should draw to, use C_LAYER_TOP for on top of everything |
drawType | One of the C_DRAW_TYPE_CONSTANTS. |
nil DrawRect(Rectf area, Color col, number layerID, number drawType)
Draws a rectangle outline of the specified color at the specified layerID.
area | A Rectf object containing the coordinates of the rect |
col | A Color object that specifies the line’s color and opacity |
layerID | Onto which layer we should draw to, use C_LAYER_TOP for on top of everything |
drawType | One of the C_DRAW_TYPE_CONSTANTS. |
nil DrawFilledRect(Rectf area, Color col, number layerID, number drawType)
Draws a filled rectangle of the specified color at the specified layerID.
area | A Rectf object containing the coordinates of the rect |
col | A Color object that specifies the line’s color and opacity |
layerID | Onto which layer we should draw to, use C_LAYER_TOP for on top of everything |
drawType | One of the C_DRAW_TYPE_CONSTANTS. |
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. |
Used with the DrawManager