Line

From Spheriki

Jump to: navigation, search

Line draws a line on the screen in the specified color.

Usage

Line(x1, y1, x2, y2, color);
  • x1 The x coordinate to start at, in pixels.
  • y1 The y coordinate to start at, in pixels.
  • x2 The x coordinate to end at, in pixels.
  • y2 The y coordinate to end at, in pixels.
  • color The Sphere Color object to draw the line with.

Examples

var white = CreateColor(255, 255, 255);
Line(0, 0, 320, 240, white);

If the resolution is set to 320x240, will draw a white line from the top left to the bottom right of the screen.

var white = CreateColor(255, 255, 255);
Line(0, 0, GetScreenWidth(), GetScreenHeight(), white);

Same as the one above, except it takes the screen width and screen height as ending points. This will draw a diagonal line from the top-left of the screen to the bottom-right, at any resolution.

Line(20, 14, 50, 75, CreateColor(0, 0, 255));

Draws a blue line from coordinates (20, 14) to (15, 75).

See also

Personal tools