MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / tftprintln

Function tftprintln

src/display.cpp:1314–1329  ·  view source on GitHub ↗

** Function: tftprintln ** similar to tft->println(), but allows to include margin **********************************************************************/

Source from the content-addressed store, hash-verified

1312** similar to tft->println(), but allows to include margin
1313**********************************************************************/
1314void tftprintln(String txt, int margin, int numlines) {
1315 int size = txt.length();
1316 if (numlines == 0) numlines = (tftHeight - 2 * margin) / (tft->getTextsize() * 8);
1317 int nchars = (tftWidth - 2 * margin) / (6 * tft->getTextsize()); // 6 pixels of width fot a letter size 1
1318 int x = tft->getCursorX();
1319 int start = 0;
1320 while (size > 0 && numlines > 0) {
1321 if (tft->getCursorX() < margin) tft->setCursor(margin, tft->getCursorY());
1322 nchars = (tftWidth - tft->getCursorX() - margin) /
1323 (6 * tft->getTextsize()); // 6 pixels of width fot a letter size 1
1324 tft->println(txt.substring(0, nchars));
1325 txt = txt.substring(nchars);
1326 size -= nchars;
1327 numlines--;
1328 }
1329}
1330/*********************************************************************
1331** Function: tftprintln
1332** similar to tft->println(), but allows to include margin

Callers 5

displayCurrentVersionFunction · 0.85
webInterface.cppFile · 0.85
drawRangeSliderFunction · 0.85
showPartitionDetailsFunction · 0.85
showFreeRangeDetailsFunction · 0.85

Calls 5

printlnMethod · 0.80
getTextsizeMethod · 0.45
getCursorXMethod · 0.45
setCursorMethod · 0.45
getCursorYMethod · 0.45

Tested by

no test coverage detected