mirror of
https://github.com/pelgraine/Meck.git
synced 2026-05-07 13:54:52 +02:00
Implement getTextWidth for display classes
- Added getTextWidth method to DisplayDriver interface - Implemented getTextWidth in all display classes - Updated examples to use getTextWidth directly
This commit is contained in:
@@ -44,6 +44,7 @@ void ST7789Display::startFrame(Color bkg) {
|
||||
}
|
||||
|
||||
void ST7789Display::setTextSize(int sz) {
|
||||
_textSize = sz; // Store the text size
|
||||
switch(sz) {
|
||||
case 1 :
|
||||
display.setFont(ArialMT_Plain_10);
|
||||
@@ -107,6 +108,10 @@ void ST7789Display::drawXbm(int x, int y, const uint8_t* bits, int w, int h) {
|
||||
display.drawBitmap(x+X_OFFSET, y, w, h, bits);
|
||||
}
|
||||
|
||||
uint16_t ST7789Display::getTextWidth(const char* str) {
|
||||
return display.getStringWidth(str);
|
||||
}
|
||||
|
||||
void ST7789Display::endFrame() {
|
||||
display.display();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user