From c82e1f2902d6a88f0e54afc8adc83fa7584e163b Mon Sep 17 00:00:00 2001 From: Dav999-v Date: Tue, 17 Jan 2023 04:47:17 +0100 Subject: [PATCH] Use PR_RIGHT for interim version info in main menu This used some constants counting numbers of characters (LEN_INTERIM_COMMIT and LEN_BRANCH_NAME) and even an SDL_arraysize, all multiplied by 8, to get the length of the displayed text. Now it just uses the new PR_RIGHT flag of font::print. I did also force the 8x8 font for all the interim information, since the date kinda overlapped with the menu options... And all of these lines only show up in interim versions anyway, except for the version number - which is left in the interface font for consistency with the rest of the menu in non-interim versions. The inconsistency in interim versions doesn't really matter all that much I think, it's just some technical/debug info. --- desktop_version/src/InterimVersion.h | 2 -- desktop_version/src/InterimVersion.in.c | 2 -- desktop_version/src/Render.cpp | 8 ++++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/desktop_version/src/InterimVersion.h b/desktop_version/src/InterimVersion.h index 98abf9e8..f2780b6c 100644 --- a/desktop_version/src/InterimVersion.h +++ b/desktop_version/src/InterimVersion.h @@ -9,12 +9,10 @@ extern "C" #endif extern const char* INTERIM_COMMIT; -extern const int LEN_INTERIM_COMMIT; extern const char* COMMIT_DATE; extern const char* BRANCH_NAME; -extern const int LEN_BRANCH_NAME; #ifdef __cplusplus } /* extern "C" */ diff --git a/desktop_version/src/InterimVersion.in.c b/desktop_version/src/InterimVersion.in.c index dceacdf3..d5d361a3 100644 --- a/desktop_version/src/InterimVersion.in.c +++ b/desktop_version/src/InterimVersion.in.c @@ -1,7 +1,5 @@ const char* INTERIM_COMMIT = "@INTERIM_COMMIT@"; -const int LEN_INTERIM_COMMIT = sizeof("@INTERIM_COMMIT@") - 1; const char* COMMIT_DATE = "@COMMIT_DATE@"; const char* BRANCH_NAME = "@BRANCH_NAME@"; -const int LEN_BRANCH_NAME = sizeof("@BRANCH_NAME@") - 1; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index fe949847..877113bc 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -173,11 +173,11 @@ static void menurender(void) font::print(PR_RIGHT, 264, temp+35, loc::gettext("MAKE AND PLAY EDITION"), tr, tg, tb); #endif #ifdef INTERIM_VERSION_EXISTS - graphics.Print( 310 - (10*8), 200, COMMIT_DATE, tr/2, tg/2, tb/2); - graphics.Print( 310 - LEN_INTERIM_COMMIT * 8, 210, INTERIM_COMMIT, tr/2, tg/2, tb/2); - graphics.Print( 310 - LEN_BRANCH_NAME * 8, 220, BRANCH_NAME, tr/2, tg/2, tb/2); + font::print(PR_RIGHT | PR_FONT_8X8, 310, 200, COMMIT_DATE, tr/2, tg/2, tb/2); + font::print(PR_RIGHT | PR_FONT_8X8, 310, 210, INTERIM_COMMIT, tr/2, tg/2, tb/2); + font::print(PR_RIGHT | PR_FONT_8X8, 310, 220, BRANCH_NAME, tr/2, tg/2, tb/2); #endif - graphics.Print( 310 - (SDL_arraysize(RELEASE_VERSION) - 1) * 8, 230, RELEASE_VERSION, tr/2, tg/2, tb/2); + font::print(PR_RIGHT, 310, 230, RELEASE_VERSION, tr/2, tg/2, tb/2); if(music.mmmmmm){ graphics.Print( 10, 230, loc::gettext("[MMMMMM Mod Installed]"), tr/2, tg/2, tb/2);