diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index c913c404..3bd41e8d 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -573,8 +573,16 @@ static void editormenurender(int tr, int tg, int tb) int len_label = font::len(0, label); const char* name = font::get_level_font_display_name(); - font::print(0, 2, 230, label, tr / 2, tg / 2, tb / 2); - font::print(PR_FONT_LEVEL, 2 + len_label, 230, name, tr / 2, tg / 2, tb / 2); + int font_x = 2 + len_label; + uint32_t font_flags = PR_FONT_LEVEL; + if (font::is_rtl(PR_FONT_INTERFACE)) + { + font_x = SCREEN_WIDTH_PIXELS - font_x; + font_flags |= PR_RIGHT; + } + + font::print(PR_RTL_XFLIP, 2, 230, label, tr / 2, tg / 2, tb / 2); + font::print(font_flags, font_x, 230, name, tr / 2, tg / 2, tb / 2); break; } case Menu::ed_music: @@ -652,8 +660,16 @@ static void editormenurender(int tr, int tg, int tb) int len_label = font::len(0, label); const char* name = font::get_level_font_display_name(); - font::print(0, 2, 230, label, tr/2, tg/2, tb/2); - font::print(PR_FONT_LEVEL, 2+len_label, 230, name, tr/2, tg/2, tb/2); + int font_x = 2 + len_label; + uint32_t font_flags = PR_FONT_LEVEL; + if (font::is_rtl(PR_FONT_INTERFACE)) + { + font_x = SCREEN_WIDTH_PIXELS - font_x; + font_flags |= PR_RIGHT; + } + + font::print(PR_RTL_XFLIP, 2, 230, label, tr/2, tg/2, tb/2); + font::print(font_flags, font_x, 230, name, tr/2, tg/2, tb/2); break; } default: diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 2a64171e..6ef9b09c 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -14,7 +14,6 @@ #include "Entity.h" #include "Enums.h" #include "FileSystemUtils.h" -#include "Font.h" #include "GlitchrunnerMode.h" #include "Graphics.h" #include "LevelDebugger.h" @@ -6487,7 +6486,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) for (uint8_t i = 0; i < font::font_idx_options_n; i++) { uint8_t idx = font::font_idx_options[i]; - option(font::get_main_font_display_name(idx), true, PR_FONT_IDX(idx, false)); + option(font::get_main_font_display_name(idx), true, PR_FONT_IDX(idx, font::is_rtl(PR_FONT_INTERFACE)) | PR_RTL_XFLIP); if (font::level_font_is_main_idx(idx)) { option_match = i; diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index c35cfbd4..48752127 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -6,6 +6,7 @@ #include #include +#include "Font.h" #include "ScreenSettings.h" /* FIXME: Can't forward declare this enum in C++, unfortunately. @@ -382,7 +383,7 @@ public: int menuspacing; std::vector menustack; - void inline option(const char* text, bool active = true, uint32_t print_flags = 0) + void inline option(const char* text, bool active = true, uint32_t print_flags = PR_RTL_XFLIP) { MenuOption menuoption; SDL_strlcpy(menuoption.text, text, sizeof(menuoption.text)); diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 99ee17b6..d45cbf1b 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -285,11 +285,11 @@ void Graphics::map_option(int opt, int num_opts, const std::string& text, bool s // Account for brackets x -= (font::len(0, buffer) - font::len(0, text_upper.c_str())) / 2; - font::print(0, x, y, buffer, 196, 196, 255 - help.glow); + font::print(PR_RTL_XFLIP, x, y, buffer, 196, 196, 255 - help.glow); } else { - font::print(0, x, y, loc::remove_toupper_escape_chars(text), 96, 96, 96); + font::print(PR_RTL_XFLIP, x, y, loc::remove_toupper_escape_chars(text), 96, 96, 96); } } diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index ae8f7eea..cc4218ca 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1637,20 +1637,20 @@ static void menurender(void) { int sp = SDL_max(10, font::height(0)); - font::print(0, 32, 65, loc::gettext("RECORDS"), tr, tg, tb); + font::print(PR_RTL_XFLIP, 32, 65, loc::gettext("RECORDS"), tr, tg, tb); const char* label = loc::gettext("TIME"); int label_len = font::len(0, label); - font::print(0, 32, 65+sp, label, tr, tg, tb); + font::print(PR_RTL_XFLIP, 32, 65+sp, label, tr, tg, tb); label = loc::gettext("SHINY"); label_len = SDL_max(label_len, font::len(0, label)); - font::print(0, 32, 65+sp*2, label, tr, tg, tb); + font::print(PR_RTL_XFLIP, 32, 65+sp*2, label, tr, tg, tb); label = loc::gettext("LIVES"); label_len = SDL_max(label_len, font::len(0, label)); - font::print(0, 32, 65+sp*3, label, tr, tg, tb); + font::print(PR_RTL_XFLIP, 32, 65+sp*3, label, tr, tg, tb); char buffer[SCREEN_WIDTH_CHARS + 1]; help.format_time(buffer, sizeof(buffer), game.besttimes[id_trial], game.bestframes[id_trial], true); - font::print(0, label_len+48, 65+sp, buffer, tr, tg, tb); + font::print(PR_RTL_XFLIP, label_len+48, 65+sp, buffer, tr, tg, tb); vformat_buf( buffer, sizeof(buffer), @@ -1658,8 +1658,8 @@ static void menurender(void) "n_trinkets:int, max_trinkets:int", game.besttrinkets[id_trial], max_trinkets ); - font::print(0, label_len+48, 65+sp*2, buffer, tr, tg, tb); - font::print(0, label_len+48, 65+sp*3, help.String(game.bestlives[id_trial]), tr, tg, tb); + font::print(PR_RTL_XFLIP, label_len+48, 65+sp*2, buffer, tr, tg, tb); + font::print(PR_RTL_XFLIP, label_len+48, 65+sp*3, help.String(game.bestlives[id_trial]), tr, tg, tb); const char* str_par_time = loc::gettext("PAR TIME"); @@ -1700,11 +1700,11 @@ static void menurender(void) } int center_x = 288 - longest_w/2; - font::print(PR_CEN, center_x, 65, str_par_time, tr, tg, tb); - font::print(PR_CEN, center_x, 65+sp, par_time, tr, tg, tb); - font::print(PR_CEN, center_x, 65+sp*3, str_best_rank, tr, tg, tb); + font::print(PR_CEN | PR_RTL_XFLIP, center_x, 65, str_par_time, tr, tg, tb); + font::print(PR_CEN | PR_RTL_XFLIP, center_x, 65+sp, par_time, tr, tg, tb); + font::print(PR_CEN | PR_RTL_XFLIP, center_x, 65+sp*3, str_best_rank, tr, tg, tb); font::print( - PR_2X | PR_CEN, + PR_2X | PR_CEN | PR_RTL_XFLIP, center_x, 66+sp*4, rank, @@ -2229,10 +2229,10 @@ void gamerender(void) { const char* tempstring = loc::gettext("TIME:"); int label_len = font::len(0, tempstring); - font::print(PR_BOR, 6, 6, tempstring, 255,255,255); + font::print(PR_BOR | PR_RTL_XFLIP, 6, 6, tempstring, 255,255,255); char buffer[SCREEN_WIDTH_CHARS + 1]; game.timestringcenti(buffer, sizeof(buffer)); - font::print(PR_BOR, 6+label_len, 6, buffer, 196,196,196); + font::print(PR_BOR | PR_RTL_XFLIP, 6+label_len, 6, buffer, 196,196,196); } bool force_roomname_hidden = false; @@ -2480,29 +2480,29 @@ void gamerender(void) //Draw OSD stuff const char* tempstring = loc::gettext("TIME:"); int label_len = font::len(0, tempstring); - font::print(PR_BOR, 6, 18, tempstring, 255,255,255); + font::print(PR_BOR | PR_RTL_XFLIP, 6, 18, tempstring, 255,255,255); tempstring = loc::gettext("DEATH:"); label_len = SDL_max(label_len, font::len(0, tempstring)); - font::print(PR_BOR, 6, 30, tempstring, 255,255,255); + font::print(PR_BOR | PR_RTL_XFLIP, 6, 30, tempstring, 255,255,255); tempstring = loc::gettext("SHINY:"); label_len = SDL_max(label_len, font::len(0, tempstring)); - font::print(PR_BOR, 6, 42, tempstring, 255,255,255); + font::print(PR_BOR | PR_RTL_XFLIP, 6, 42, tempstring, 255,255,255); if(game.timetrialparlost) { - font::print(PR_BOR, 8+label_len, 18, buffer, 196, 80, 80); + font::print(PR_BOR | PR_RTL_XFLIP, 8+label_len, 18, buffer, 196, 80, 80); } else { - font::print(PR_BOR, 8+label_len, 18, buffer, 196, 196, 196); + font::print(PR_BOR | PR_RTL_XFLIP, 8+label_len, 18, buffer, 196, 196, 196); } if(game.deathcounts>0) { - font::print(PR_BOR, 8+label_len, 30,help.String(game.deathcounts), 196, 80, 80); + font::print(PR_BOR | PR_RTL_XFLIP, 8+label_len, 30,help.String(game.deathcounts), 196, 80, 80); } else { - font::print(PR_BOR, 8+label_len, 30,help.String(game.deathcounts), 196, 196, 196); + font::print(PR_BOR | PR_RTL_XFLIP, 8+label_len, 30,help.String(game.deathcounts), 196, 196, 196); } vformat_buf( buffer, sizeof(buffer), @@ -2512,24 +2512,24 @@ void gamerender(void) ); if(game.trinkets()