Graphics::drawLine

Description

void Graphics::drawLine( int16_t x0 , int16_t y0 , int16_t x1 , int16_t y1 )

Graphics::drawLine will draw a line from (x0, y0) to (x1, y1).

Parameters

  • int16_t x0: x0 of the line to draw
  • int16_t y0: y0 of the line to draw
  • int16_t x1: x1 of the line to draw
  • int16_t y1: y1 of the line to draw

Returns

none

Example

#include <Gamebuino-Meta.h>

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

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

    // let's draw a green diagonal line
    gb.display.setColor(GREEN);
    gb.display.drawLine(0, 0, gb.display.width() - 1, gb.display.height() - 1);
  }
}