diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 94b1c969..729ed588 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -790,7 +790,7 @@ void editorrender(void) } else { - fillboxabs((customentities[i].x*8)-(ed.levx*40*8), (customentities[i].y*8)-(ed.levy*30*8), font::len(PR_FONT_LEVEL, customentities[i].scriptname), font::height(PR_FONT_LEVEL), graphics.getRGB(96,96,96)); + fillboxabs((customentities[i].x*8)-(ed.levx*40*8), (customentities[i].y*8)-(ed.levy*30*8), font::len(PR_FONT_LEVEL, customentities[i].scriptname.c_str()), font::height(PR_FONT_LEVEL), graphics.getRGB(96,96,96)); } font::print(PR_FONT_LEVEL | PR_CJK_LOW, (customentities[i].x*8)-(ed.levx*40*8), (customentities[i].y*8)-(ed.levy*30*8), customentities[i].scriptname, 196, 196, 255 - help.glow); break; @@ -1245,7 +1245,7 @@ void editorrender(void) //Draw cursor if(ed.entframe<2) { - font::print(PR_FONT_LEVEL | PR_CJK_LOW, 16+font::len(PR_FONT_LEVEL, ed.sb[ed.pagey+ed.sby]),20+(ed.sby*font_height),"_",123, 111, 218); + font::print(PR_FONT_LEVEL | PR_CJK_LOW, 16+font::len(PR_FONT_LEVEL, ed.sb[ed.pagey+ed.sby].c_str()),20+(ed.sby*font_height),"_",123, 111, 218); } break; } diff --git a/desktop_version/src/Font.cpp b/desktop_version/src/Font.cpp index be52c49f..b94e4bc0 100644 --- a/desktop_version/src/Font.cpp +++ b/desktop_version/src/Font.cpp @@ -1147,13 +1147,12 @@ bool glyph_dimensions(uint32_t flags, uint8_t* glyph_w, uint8_t* glyph_h) return true; } -int len(const uint32_t flags, const std::string& t) +int len(const uint32_t flags, const char* text) { PrintFlags pf = decode_print_flags(flags); int text_len = 0; uint32_t codepoint; - const char* text = t.c_str(); // TODO no std::string while ((codepoint = UTF8_next(&text))) { text_len += get_advance(pf.font_sel, codepoint); diff --git a/desktop_version/src/Font.h b/desktop_version/src/Font.h index d4524183..94f62cb1 100644 --- a/desktop_version/src/Font.h +++ b/desktop_version/src/Font.h @@ -81,7 +81,7 @@ std::string string_unwordwrap(const std::string& s); bool glyph_dimensions(uint32_t flags, uint8_t* glyph_w, uint8_t* glyph_h); -int len(uint32_t flags, const std::string& t); +int len(uint32_t flags, const char* text); int height(const uint32_t flags); void print( diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index f5842e5c..d3aa6972 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -468,7 +468,7 @@ void Graphics::print_level_creator( * - it makes sense to make it a face * - if anyone is sad about this decision, the happy face will cheer them up anyway :D */ int width_for_face = 17; - int total_width = width_for_face + font::len(print_flags, creator); + int total_width = width_for_face + font::len(print_flags, creator.c_str()); int face_x = (SCREEN_WIDTH_PIXELS-total_width)/2; set_texture_color_mod(grphx.im_sprites, r, g, b); draw_texture_part(grphx.im_sprites, face_x, y-1, 7, 2, 10, 10, 1, 1); @@ -1366,7 +1366,7 @@ void Graphics::createtextboxreal( textboxclass text; text.lines.push_back(t); text.xp = xp; - if (xp == -1) text.xp = 160 - ((font::len(PR_FONT_LEVEL, t) / 2) + 8); + if (xp == -1) text.xp = 160 - ((font::len(PR_FONT_LEVEL, t.c_str()) / 2) + 8); text.yp = yp; text.initcol(r, g, b); text.flipme = flipme; @@ -1567,7 +1567,7 @@ void Graphics::drawmenu(int cr, int cg, int cb, enum Menu::MenuName menu) vformat_buf(buffer, sizeof(buffer), loc::get_langmeta()->menu_select.c_str(), "label:str", opt_text.c_str()); // Account for brackets - x -= (font::len(opt.print_flags, buffer)-font::len(opt.print_flags, opt_text))/2; + x -= (font::len(opt.print_flags, buffer)-font::len(opt.print_flags, opt_text.c_str()))/2; } else { diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 2a8f920c..a023171d 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1497,7 +1497,7 @@ static void menurender(void) int w[4] = { font::len(0, str_par_time), - font::len(0, par_time), + font::len(0, par_time.c_str()), font::len(0, str_best_rank), font::len(PR_2X, rank) }; @@ -2189,7 +2189,7 @@ void gamerender(void) } std::string time = game.timetstring(game.timetrialpar); - label_len = font::len(0, time); + label_len = font::len(0, time.c_str()); if(game.timetrialparlost) { font::print(PR_BOR | PR_RIGHT, 307-label_len-8, 214, loc::gettext("PAR TIME:"), 80, 80, 80); diff --git a/desktop_version/src/RoomnameTranslator.cpp b/desktop_version/src/RoomnameTranslator.cpp index 1f0a5e5e..aa29f4b8 100644 --- a/desktop_version/src/RoomnameTranslator.cpp +++ b/desktop_version/src/RoomnameTranslator.cpp @@ -186,7 +186,7 @@ namespace roomname_translator { *force_roomname_hidden = true; graphics.render_roomname(PR_FONT_LEVEL, key.keybuffer.c_str(), 255,255,255); - int name_w = font::len(PR_FONT_LEVEL, key.keybuffer); + int name_w = font::len(PR_FONT_LEVEL, key.keybuffer.c_str()); font::print(PR_BOR | PR_FONT_LEVEL, (320-name_w)/2+name_w, 231, "_", 255,255,255); } else if (!roomname_is_translated) diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index f08f11a9..1eb553bc 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -106,7 +106,7 @@ void textboxclass::resize(void) int max = 0; for (size_t iter = 0; iter < lines.size(); iter++) { - int len = font::len(print_flags, lines[iter]); + int len = font::len(print_flags, lines[iter].c_str()); if (len > max) max = len; }