Graphics::drawTriangle

Description

void Graphics::drawTriangle( int16_t x0 , int16_t y0 , int16_t x1 , int16_t y1 , int16_t x2 , int16_t y2 )

Graphics::drawTriangle draws a triangle (line only) between three points, (x0, y0), (x1, y1) and (x2, y2).

Parameters

  • int16_t x0: x-coordinate of 0th point
  • int16_t y0: y-coordinate of 0th point
  • int16_t x1: x-coordinate of 1st point
  • int16_t y1: y-coordinate of 1st point
  • int16_t x2: x-coordinate of 2nd point
  • int16_t y2: y-coordinate of 2nd point

Returns

none

Example

#include <Gamebuino-Meta.h>

void setup() {
  gb.begin();
}

void loop() {
  if (gb.update()) {
    gb.display.clear();

    // draw a green triangle
    gb.display.setColor(GREEN);
    gb.display.drawTriangle(0, 10, 10, 0, 20, 10);
  }
}