mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00: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:
parent
e442e94e3d
commit
678f36a57b
10 changed files with 32 additions and 8 deletions
|
|
@ -144,7 +144,7 @@ void UITask::renderCurrScreen() {
|
|||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
int textWidth = strlen(_version_info) * 5; // Assuming each character is 5 pixels wide
|
||||
uint16_t textWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - textWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
} else { // home screen
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue