You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
806 B
C++
43 lines
806 B
C++
4 years ago
|
#include "faceSplash.h"
|
||
|
#include "settings.h"
|
||
|
#include "display.h"
|
||
|
#include "datetime.h"
|
||
|
|
||
|
#include <Fonts/FreeMono24pt7b.h>
|
||
|
|
||
|
void setupFaceSplash()
|
||
|
{
|
||
|
// NOP
|
||
|
}
|
||
|
|
||
|
void loopFaceSplash()
|
||
|
{
|
||
|
// NOP
|
||
|
}
|
||
|
|
||
|
void showFaceSplash()
|
||
|
{
|
||
|
// init
|
||
|
GFXcanvas1 *canvas = displayGetCanvas();
|
||
|
const char Hello[] = "Hello paperdash!";
|
||
|
|
||
|
// setup
|
||
|
canvas->setFont(&FreeMono24pt7b);
|
||
|
canvas->setRotation(0);
|
||
|
canvas->fillScreen(COLOR_BG);
|
||
|
canvas->setTextColor(COLOR_FG);
|
||
|
|
||
|
// center bounding box by transposition of origin:
|
||
|
int16_t tbx, tby;
|
||
|
uint16_t tbw, tbh;
|
||
|
canvas->getTextBounds(Hello, 0, 0, &tbx, &tby, &tbw, &tbh);
|
||
|
uint16_t x = ((canvas->width() - tbw) / 2) - tbx;
|
||
|
uint16_t y = ((canvas->height() - tbh) / 2) - tby;
|
||
|
|
||
|
// print text
|
||
|
canvas->setCursor(x, y);
|
||
|
canvas->print(Hello);
|
||
|
|
||
|
// update screen
|
||
|
displayFlush();
|
||
|
}
|