Even on my small 128x160 TFT screen, it's a pain to make a layout for all the text.
I now use a Grid and I'm very happy with that, it's very helpful!
Just one function call to include or comment out while coding.
But I'm curious what others use as a guide??
// I'm using the TFT_eSPI library, but it should be compatible with the Adafruit GFX lib?
void drawGrid()
{
// minor lines: 5,15,25 etc.
// major lines: 10,20,30 etc.
// make the major lines a bit brighter!
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 160
#define MINOR_GRID tft.color565(150, 150, 150)
#define MAJOR_GRID tft.color565(180, 180, 180)
#define GRID_EDGE tft.color565(255, 0, 0)
#define V_CENTER tft.color565(255, 0, 0)
#define H_CENTER tft.color565(255, 0, 0)
// draw minor lines first so that the major lines overlap them on the
// cross-sections
for (int v = 5; v < SCREEN_WIDTH; v += 10)
{
// minor: 5,15,25 etc /
tft.drawFastVLine(v, 0, SCREEN_HEIGHT, MINOR_GRID);
}
for (int h = 5; h < SCREEN_HEIGHT; h += 10)
{
// minor: 5,15,25 etc
tft.drawFastHLine(0, h, SCREEN_HEIGHT, MINOR_GRID);
}
// next major lines, overlapping the minor lines at cross-sections
for (int v = 10; v < SCREEN_WIDTH; v += 10)
{
// main: 0,10,20 etc
tft.drawFastVLine(v, 0, SCREEN_HEIGHT, MAJOR_GRID);
}
for (int h = 10; h < SCREEN_HEIGHT; h += 10)
{
// main: 0,10,20 etc
tft.drawFastHLine(0, h, SCREEN_HEIGHT, MAJOR_GRID);
}
// edge lines
tft.drawFastVLine(0, 0, SCREEN_HEIGHT - 1, GRID_EDGE);
tft.drawFastVLine(SCREEN_WIDTH - 1, 0, SCREEN_HEIGHT - 1, GRID_EDGE);
tft.drawFastHLine(0, 0, SCREEN_WIDTH - 1, GRID_EDGE);
tft.drawFastHLine(0, SCREEN_HEIGHT - 1, SCREEN_HEIGHT - 1, GRID_EDGE);
// center lines
tft.drawFastVLine(SCREEN_WIDTH / 2 - 1, 0, SCREEN_HEIGHT - 1, V_CENTER);
tft.drawFastHLine(0, SCREEN_HEIGHT / 2 - 1, SCREEN_HEIGHT - 1, V_CENTER);
}