Triangle

From Spheriki

Jump to: navigation, search

Draws a filled triangle on the screen in the specified color.

Contents

Usage

Triangle(x1, y1, x2, y2, x3, y3, color);
  • x1 The x coordinate of the first vertex, in pixels.
  • y1 The y coordinate of the first vertex, in pixels.
  • x2 The x coordinate of the second vertex, in pixels.
  • y2 The y coordinate of the second vertex, in pixels.
  • x2 The x coordinate of the last vertex, in pixels.
  • y2 The y coordinate of the last vertex, in pixels.
  • color The Sphere Color object to draw the triangle with.

Examples

var white = CreateColor(255, 255, 255);
Triangle(0, 0, 100, 0, 0, 100, white);

Draws a white colored right angle triangle at the top left hand corner of the screen.

Triangle(30, 30, 15, 60, 45, 60, CreateColor(0, 0, 255));

Draws a blue isosceles triangle with vertices at (30, 30), (15, 60), and (45, 60).

Notes

As with all graphical functions, remember to use FlipScreen() to display the results on the screen when you're finished drawing.

See also