LineSeries

From Spheriki

Jump to: navigation, search

Draws a series of lines with the specified color onto the video buffer.


Contents

Usage

LineSeries(array, color [, type]);
  • array Array filled with objects. Each object must have an x and y property.
  • color The Sphere Color object to draw the lines with.
  • type Sets the type of lines to draw. Can be one of LINE_MULTIPLE - Every two points draws a line, LINE_STRIP - One long line is drawn or LINE_LOOP - Same as LINE_STRIP except the start and end are joined.


Examples

var ObjectArray = [{x:20, y:50}, {x:80, y:20}, {x:10, y:140}, {x:60, y:140}];
LineSeries(ObjectArray, CreateColor(255,255,255), LINE_MULTIPLE);

This will draw two white lines. One from (20, 50) to (80, 20) and the other from (10, 140) to (60, 140).

var ObjectArray = [{x:20, y:50}, {x:80, y:20}, {x:10, y:140}, {x:60, y:140}];
LineSeries(ObjectArray, CreateColor(255,255,255), LINE_STRIP);

Same example but with LINE_STRIP. This gives a 'Z' shape.

var ObjectArray = [{x:20, y:50}, {x:80, y:20}, {x:10, y:140}, {x:60, y:140}];
LineSeries(ObjectArray, CreateColor(255,255,255), LINE_LOOP);

Same example again but with LINE_LOOP. This gives an hourglass shape.

Notes

Don't forget to call FlipScreen() after doing any drawing on the video buffer.


See also

Personal tools