Skip to main content

DrawRectangle

This function was added in DSL 1

Description

Draws a rectangle on the screen with the specified position, size, and color.

Position and size in normalized coords, relative to the screen, 0-1.

function DrawRectangle(x, y, width, height, red, green, blue, alpha) --[[ ... ]] end

Parameters

  • x: number - The x-coordinate of the rectangle's top-left corner (0-1).
  • y: number - The y-coordinate of the rectangle's top-left corner (0-1).
  • width: number - The width of the rectangle (0-1).
  • height: number - The height of the rectangle (0-1).
  • red: number - The red component of the rectangle's color (0-255).
  • green: number - The green component of the rectangle's color (0-255).
  • blue: number - The blue component of the rectangle's color (0-255).
  • alpha: number - The alpha component of the rectangle's color (0-255).

Return Values

None.

Example

Draws a red rectangle at (10%, 10%) with size (20%, 20%)

DrawRectangle(0.1, 0.1, 0.2, 0.2, 255, 0, 0, 255)