diff --git a/desktop_version/src/Font.cpp b/desktop_version/src/Font.cpp index 49c9df52..be52c49f 100644 --- a/desktop_version/src/Font.cpp +++ b/desktop_version/src/Font.cpp @@ -1176,7 +1176,7 @@ void print( const uint32_t flags, int x, int y, - const std::string& text, + const char* text, const uint8_t r, const uint8_t g, const uint8_t b @@ -1239,9 +1239,8 @@ void print( } int position = 0; - const char* str = text.c_str(); // TODO no std::string uint32_t codepoint; - while ((codepoint = UTF8_next(&str))) + while ((codepoint = UTF8_next(&text))) { position += font::print_char( pf.font_sel, @@ -1257,6 +1256,20 @@ void print( } } +void print( + const uint32_t flags, + int x, + int y, + const std::string& text, + const uint8_t r, + const uint8_t g, + const uint8_t b +) +{ + // Just a std::string overload for now because it's more .c_str() to add than I'm comfortable with... + print(flags, x, y, text.c_str(), r, g, b); +} + int print_wrap( uint32_t flags, const int x, diff --git a/desktop_version/src/Font.h b/desktop_version/src/Font.h index b768796e..d4524183 100644 --- a/desktop_version/src/Font.h +++ b/desktop_version/src/Font.h @@ -84,6 +84,15 @@ bool glyph_dimensions(uint32_t flags, uint8_t* glyph_w, uint8_t* glyph_h); int len(uint32_t flags, const std::string& t); int height(const uint32_t flags); +void print( + uint32_t flags, + int x, + int y, + const char* text, + uint8_t r, uint8_t g, uint8_t b +); + +// std::string overload for only font::print (use .c_str() for the others) void print( uint32_t flags, int x,