/*
CREATIVE SOFTWARE 1.0
FOR CREATIVE DEVICE 2
AUTHOR: KAP PETROV, THEO LAPUS
*/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
int ts = 2;
uint16_t tc = ILI9341_WHITE;
void InitDisplay(uint16_t textcolor, int textsize)
{
tft.begin();
tft.setCursor(0, 0);
tft.setTextColor(textcolor);
tft.setTextSize(textsize);
ts = textsize;
tc = textcolor;
}
void drawText(char* str, int x, int y, int textsize=ts, uint16_t textclr=tc)
{
tft.setCursor(x, y);
tft.setTextSize(textsize);
tft.setTextColor(textclr);
tft.println(str);
}
void App(char* name, int x, int y, uint16_t color, void* func)
{
tft.fillRect(x, y, 50, 50, color);
drawText(name, x, y + 51);
func();
}
void Option(char* name, int x, int y, uint16_t color)
{
tft.fillRect(x, y, 60, 25, color);
drawText(name, x, y);
}
void setup() {
InitDisplay(ILI9341_WHITE, 2);
// Home screen color
tft.fillScreen(ILI9341_NAVY);
// Warnings And Info
drawText("Creative Software 1", 0, 250);
drawText("WARNING: PROTOTYPE SOFTWARE", 0, 270, ts, ILI9341_RED);
// Options
Option("Home", 0, 0, ILI9341_BLACK);
Option("Edit", 60, 0, ILI9341_BLACK);
// Apps
}
void loop() { }