#include <TFT_eSPI.h>
#include <SPI.h> // this is needed for display
#include <Wire.h> // this is needed for FT6206
#include <Adafruit_FT6206.h>
#include <QList.h>;
TFT_eSPI screen = TFT_eSPI(); // Invoke custom library
#include "tft_settings.h";
#include "randomColor.h";
#include "ball.h";
int timePeriod = 1000;
unsigned long time_now = 0;
int period = 1000;
QList<ball> ballList;
void setup() {
pinMode(27, INPUT);
screen.init();
screen.fillScreen(TFT_BLACK);
screen.setRotation(8);
for (int i = 0; i < 10; i++) {
ballList.push_back(ball(random(0,5)));
}
}
int fps = 0;
void loop() {
fps++;
if (millis() >= time_now + timePeriod) {
time_now += timePeriod;
screen.drawString("fps: " + String(fps) + " ", 0, 0, 2);
fps = 0;
}
for (int i = 0; i < ballList.size(); i++) {
ballList.at(i).run();
}
}