Surface.line

From Spheriki

Jump to: navigation, search

Draw a line with the given color on the surface.


Usage

surface.line(x1, y1, x2, y2, color);
  • surface Sphere Surface object. The surface to draw the line on.
  • x1, y1 numbers. Coordinates of the top-left of the line, in pixels.
  • x2, y2 numbers. Coordinates of the bottom-right of the line, in pixels.
  • param1 description
  • color Sphere Color object. The desired color of the line.


Examples

Draw two diagonal lines from the top-left to the bottom-right of the surface, and the top-right to the bottom-left of the surface.

var red = CreateColor(255,0,0);
var green = CreateColor(0,255,0);
var s = CreateSurface(320, 240, CreateColor(0,0,0));

s.line(0, 0, 320, 240, red);   //Top-left to bottom-right
s.line(320, 0, 0, 240, green); //Top-right to bottom-left


See also

Personal tools