diff --git a/PDQ_MinLib/PDQ_GFX.h b/PDQ_MinLib/PDQ_GFX.h index f2a551e..abc5735 100644 --- a/PDQ_MinLib/PDQ_GFX.h +++ b/PDQ_MinLib/PDQ_GFX.h @@ -158,7 +158,7 @@ public: static inline uint8_t getRotation() __attribute__ ((always_inline)) { return rotation; } static inline coord_t getCursorX() __attribute__ ((always_inline)) { return cursor_x; } static inline coord_t getCursorY() __attribute__ ((always_inline)) { return cursor_y; } - static inline void getTextBounds(char *string, coord_t x, coord_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h, coord_t wi = _width); + static inline void getTextBounds(const char *string, coord_t x, coord_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h, coord_t wi = _width); static inline void getTextBounds(const __FlashStringHelper *s, coord_t x, coord_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h, coord_t wi = _width); virtual size_t write(uint8_t); // used by Arduino "Print.h" (and the one required virtual function) @@ -1061,7 +1061,7 @@ void PDQ_GFX::setFont(const GFXfont *f) // Pass string and a cursor position, returns UL corner and W,H. template -void PDQ_GFX::getTextBounds(char *str, coord_t x, coord_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h, coord_t wi) +void PDQ_GFX::getTextBounds(const char *str, coord_t x, coord_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h, coord_t wi) { uint8_t c; // Current character diff --git a/nano_gui.cpp b/nano_gui.cpp index 92336d1..e6590bb 100644 --- a/nano_gui.cpp +++ b/nano_gui.cpp @@ -64,14 +64,14 @@ void displayChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t tft.drawCharGFX(x,y,c,color,bg,1); } -void displayRawText(char *text, int x1, int y1, int w, int color, int background){ +void displayRawText(const char *text, int x1, int y1, int w, int color, int background){ tft.setTextColor(color,background); tft.setCursor(x1,y1); tft.setBound(x1,x1+w); tft.print(text); } -void displayText(char *text, int x1, int y1, int w, int h, int color, int background, int border, TextJustification_e justification) +void displayText(const char *const text, int x1, int y1, int w, int h, int color, int background, int border, TextJustification_e justification) { displayFillrect(x1, y1, w ,h, background); displayRect(x1, y1, w ,h, border); diff --git a/nano_gui.h b/nano_gui.h index e35145d..71b2d51 100644 --- a/nano_gui.h +++ b/nano_gui.h @@ -16,7 +16,7 @@ void displayVline(unsigned int x, unsigned int y, unsigned int l, unsigned int c void displayRect(unsigned int x,unsigned int y,unsigned int w,unsigned int h,unsigned int c); void displayFillrect(unsigned int x,unsigned int y,unsigned int w,unsigned int h,unsigned int c); void displayChar(int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg); -void displayText(char *text, int x1, int y1, int w, int h, int color, int background, int border, TextJustification_e justification = TextJustification_e::Center); +void displayText(const char *const text, int x1, int y1, int w, int h, int color, int background, int border, TextJustification_e justification = TextJustification_e::Center); #define TEXT_LINE_HEIGHT 18 #define TEXT_LINE_INDENT 5