#define DOUBLEBUFFERING 1
struct Test {
virtual ~Test() { };
virtual void update() = 0;
virtual bool nextState() = 0;
virtual int testState() = 0;
virtual char const * name() = 0;
};
#include "ballstest.h"
#include "polygonstest.h"
#include "spritestest.h"
void setup()
{
DisplayController.begin();
canvas.selectFont(&fabgl::FONT_8x8);
}
void loop()
{
static int64_t stime = esp_timer_get_time();
static int FPS = 0;
static int FPSCounter = 0;
static int testIndex = 0;
static Test * test = new BallsTest;
if (test->nextState() == false) {
delete test;
++testIndex;
switch (testIndex) {
case 1:
test = new PolygonsTest;
break;
case 2:
test = new SpritesTest;
break;
default:
testIndex = 0;
test = new BallsTest;
break;
}
}
if (esp_timer_get_time() - stime > 1000000) {
FPS = FPSCounter;
stime = esp_timer_get_time();
FPSCounter = 0;
}
++FPSCounter;
test->update();
canvas.drawTextFmt(80, 5, " %d %s at %d FPS ", test->testState(), test->name(), FPS);
if (DOUBLEBUFFERING)
canvas.swapBuffers();
}
A class with a set of drawing methods.
Represents the VGA bitmapped controller.
GlyphOptions & FillBackground(bool value)
Helper method to set or reset fillBackground.
This file is the all in one include file. Application can just include this file to use FabGL library...