MCPcopy Create free account
hub / github.com/Blueforcer/awtrix3 / printText

Method printText

src/DisplayManager.cpp:161–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void DisplayManager_::printText(int16_t x, int16_t y, const char *text, bool centered, byte textCase)
162{
163
164 if (centered)
165 {
166 uint16_t textWidth = getTextWidth(text, textCase);
167 int16_t textX = ((32 - textWidth) / 2);
168 setCursor(textX, y);
169 }
170 else
171 {
172 setCursor(x, y);
173 }
174
175 if ((UPPERCASE_LETTERS && textCase == 0) || textCase == 1)
176 {
177 size_t length = strlen(text);
178 char upperText[length + 1]; // +1 for the null terminator
179
180 for (size_t i = 0; i < length; ++i)
181 {
182 upperText[i] = toupper(text[i]);
183 }
184
185 upperText[length] = '\0'; // Null terminator
186 matrixPrint(upperText);
187 }
188 else
189 {
190 matrixPrint(text);
191 }
192}
193
194void DisplayManager_::HSVtext(int16_t x, int16_t y, const char *text, bool clear, byte textCase)
195{

Callers 10

MenuOverlayFunction · 0.80
NotifyOverlayFunction · 0.80
TimeAppFunction · 0.80
DateAppFunction · 0.80
ShowCustomAppFunction · 0.80
update_progressFunction · 0.80
update_errorFunction · 0.80
checkUpdateMethod · 0.80
tickMethod · 0.80
tickMethod · 0.80

Calls 1

getTextWidthFunction · 0.85

Tested by

no test coverage detected