#include "SPI.h"
#include <TFT_eSPI.h>
#include <Adafruit_GFX.h>
#include "Playground12pt7b.h"
TFT_eSPI tft = TFT_eSPI();
void setup() {
tft.begin();
tft.setRotation(1);
tft.loadFont(Playground12pt7b);
drawStylizedText("OFFLINE", 10, 50, tft.color565(255, 50, 100), tft.color565(255, 100, 200), tft.color565(255, 200, 0));
drawTextWithOutline(10, 100, "OFFLINE", tft.color565(199, 59, 119), tft.color565(241, 206, 75), tft.color565(217, 107, 232));
}
void loop() {}
void drawStylizedText(const char* text, int16_t x, int16_t y, uint16_t mainColor, uint16_t outlineColor, uint16_t shadowColor) {
tft.setTextSize(1); // Ajustez selon vos besoins
// Ombre
tft.setTextColor(shadowColor);
tft.setCursor(x - 3, y + 3);
tft.print(text);
// Contour
tft.setTextColor(outlineColor);
for (int8_t i = -1; i <= 1; i++) {
for (int8_t j = -1; j <= 1; j++) {
if (i != 0 || j != 0) {
tft.setCursor(x + i, y + j);
tft.print(text);
}
}
}
// Texte principal
tft.setTextColor(mainColor);
tft.setCursor(x, y);
tft.print(text);
}
void drawTextWithOutline(int16_t x, int16_t y, const char* text, uint16_t textColor, uint16_t shadowColor, uint16_t outlineColor) {
// Dessiner les ombres
tft.setTextColor(shadowColor);
tft.setCursor(x - 2, y + 2); // Légèrement décalé pour l'ombre
tft.print(text);
// Dessiner le contour
tft.setTextColor(outlineColor);
tft.setCursor(x - 1, y - 1);
tft.print(text);
tft.setCursor(x + 1, y - 1);
tft.print(text);
tft.setCursor(x - 1, y + 1);
tft.print(text);
tft.setCursor(x + 1, y + 1);
tft.print(text);
// Dessiner le texte principal
tft.setTextColor(textColor);
tft.setCursor(x, y);
tft.print(text);
}