Correct datum marker for different screen sizes

datum marker was not in correct position on screens that are not 320x240 pixels
This commit is contained in:
Bodmer
2018-10-23 14:20:45 +01:00
committed by GitHub
parent d12a68a49d
commit b93a40a54f

View File

@@ -148,73 +148,73 @@ void loop() {
tft.loadFont(AA_FONT_SMALL); tft.loadFont(AA_FONT_SMALL);
tft.setTextDatum(TL_DATUM); tft.setTextDatum(TL_DATUM);
tft.drawString("[Top left]", xpos, ypos); tft.drawString("[Top left]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(TC_DATUM); tft.setTextDatum(TC_DATUM);
tft.drawString("[Top centre]", xpos, ypos); tft.drawString("[Top centre]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(TR_DATUM); tft.setTextDatum(TR_DATUM);
tft.drawString("[Top right]", xpos, ypos); tft.drawString("[Top right]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(ML_DATUM); tft.setTextDatum(ML_DATUM);
tft.drawString("[Middle left]", xpos, ypos); tft.drawString("[Middle left]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(MC_DATUM); tft.setTextDatum(MC_DATUM);
tft.drawString("[Middle centre]", xpos, ypos); tft.drawString("[Middle centre]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(MR_DATUM); tft.setTextDatum(MR_DATUM);
tft.drawString("[Middle right]", xpos, ypos); tft.drawString("[Middle right]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(BL_DATUM); tft.setTextDatum(BL_DATUM);
tft.drawString("[Bottom left]", xpos, ypos); tft.drawString("[Bottom left]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(BC_DATUM); tft.setTextDatum(BC_DATUM);
tft.drawString("[Bottom centre]", xpos, ypos); tft.drawString("[Bottom centre]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(BR_DATUM); tft.setTextDatum(BR_DATUM);
tft.drawString("[Bottom right]", xpos, ypos); tft.drawString("[Bottom right]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(L_BASELINE); tft.setTextDatum(L_BASELINE);
tft.drawString("[Left baseline]", xpos, ypos); tft.drawString("[Left baseline]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(C_BASELINE); tft.setTextDatum(C_BASELINE);
tft.drawString("[Centre baseline]", xpos, ypos); tft.drawString("[Centre baseline]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
tft.setTextDatum(R_BASELINE); tft.setTextDatum(R_BASELINE);
tft.drawString("[Right baseline]", xpos, ypos); tft.drawString("[Right baseline]", xpos, ypos);
drawDatumMarker(160,120); drawDatumMarker(xpos, ypos);
delay(1000); delay(1000);
tft.unloadFont(); // Remove the font to recover memory used tft.unloadFont(); // Remove the font to recover memory used