/*
  ESP32 HTTPClient Jokes API Example

  https://wokwi.com/projects/342032431249883731

  Copyright (C) 2022, Uri Shaked
*/
//Author: Raunak Raj// ps:40905004
#include "point.h"
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>

#define TFT_DC 2
#define TFT_CS 15
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

void setup() {
  tft.begin();
  tft.setRotation(1);

  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
}
point p1;
point p2;
point p3;
point p4; 
 void draw_points(point& p1, point& p2){
  tft.drawLine (p1.get_x(),p1.get_y(),
               p2.get_x(),p2.get_y(),
              ILI9341_WHITE);
 }
void loop() {
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(0,0);
 
 p1.set_x(0);
 p1.set_y(0);

 p2.set_x(0);
 p2.set_y(40);

 p3.set_x(40);
 p3.set_y(40);

 p4.set_x(0);
 p4.set_y(40);

  tft.print("Welcome to Drawing on TFT");
  //tft.drawLine(150,150,0,50,ILI9341_WHITE );
  draw_points(p1,p2);
  draw_points(p2,p3);
  draw_points(p3,p4);
  draw_points(p4,p1);

  delay(1000);
}