From 58fdabceac98dc0d6859f6bd80c966acb35a4fb9 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 3 Nov 2024 11:40:26 +0100 Subject: [PATCH] added configuration options for menu footer text position and font --- src/conf_gfx.c | 8 ++++++++ src/main.c | 1 + src/main.h | 2 ++ src/screens.c | 15 +++++++++------ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 1db6da64..c82d8640 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -7777,6 +7777,9 @@ struct ConfigInfo image_config[] = { "font.title_2.SETUP", UNDEFINED_FILENAME }, { "font.title_2.SETUP.clone_from", "font.text_2" }, + { "font.footer", UNDEFINED_FILENAME }, + { "font.footer.clone_from", "font.text_4" }, + { "font.menu_1", "RocksFontBig.png" }, { "font.menu_1.x", "0" }, { "font.menu_1.y", "320" }, @@ -9403,6 +9406,11 @@ struct ConfigInfo image_config[] = { "menu.text.title_2.align", "center" }, { "menu.text.title_2.valign", "top" }, { "menu.text.title_2.font", "font.title_2" }, + { "menu.text.footer.x", "-1" }, + { "menu.text.footer.y", "-8" }, + { "menu.text.footer.align", "center" }, + { "menu.text.footer.valign", "bottom" }, + { "menu.text.footer.font", "font.footer" }, { "main.button.name.x", "0" }, { "main.button.name.y", "64" }, diff --git a/src/main.c b/src/main.c index 24e3ffd8..bf0e68ce 100644 --- a/src/main.c +++ b/src/main.c @@ -9341,6 +9341,7 @@ struct FontInfo font_info[NUM_FONTS + 1] = { "font.initial_4" }, { "font.title_1" }, { "font.title_2" }, + { "font.footer" }, { "font.menu_1.active" }, { "font.menu_2.active" }, { "font.menu_1" }, diff --git a/src/main.h b/src/main.h index 9ca6638e..449240a4 100644 --- a/src/main.h +++ b/src/main.h @@ -2995,6 +2995,7 @@ enum FONT_INITIAL_4 = MAIN_FONT_INITIAL_4, FONT_TITLE_1, FONT_TITLE_2, + FONT_FOOTER, FONT_MENU_1_ACTIVE, FONT_MENU_2_ACTIVE, FONT_MENU_1, @@ -3245,6 +3246,7 @@ struct MenuTextInfo { struct TextPosInfo title_1; struct TextPosInfo title_2; + struct TextPosInfo footer; }; struct MenuMainButtonInfo diff --git a/src/screens.c b/src/screens.c index 97792de9..c82fde4f 100644 --- a/src/screens.c +++ b/src/screens.c @@ -173,17 +173,20 @@ #define MAX_SETUP_TEXT_INPUT_LEN 28 // for various menu stuff +#define MENU_TEXT_ALIGNED_YPOS(t) (ALIGNED_YPOS((t).y + ((t).y < 0 ? SYSIZE : 0), \ + getFontHeight((t).font), (t).valign)) #define MENU_SCREEN_START_XPOS 1 #define MENU_SCREEN_START_YPOS 2 #define MENU_SCREEN_VALUE_XPOS (SCR_FIELDX - 3) #define MENU_SCREEN_TEXT2_XPOS (SCR_FIELDX - 2) #define MENU_SCREEN_MAX_XPOS (SCR_FIELDX - 1) -#define MENU_TITLE1_YPOS (menu.text.title_1.y) -#define MENU_TITLE2_YPOS (menu.text.title_2.y) +#define MENU_TITLE1_YPOS MENU_TEXT_ALIGNED_YPOS(menu.text.title_1) +#define MENU_TITLE2_YPOS MENU_TEXT_ALIGNED_YPOS(menu.text.title_2) +#define MENU_FOOTER_YPOS MENU_TEXT_ALIGNED_YPOS(menu.text.footer) #define MENU_INFO_FONT_TITLE FONT_TEXT_1 #define MENU_INFO_FONT_HEAD FONT_TEXT_2 #define MENU_INFO_FONT_TEXT FONT_TEXT_3 -#define MENU_INFO_FONT_FOOT FONT_TEXT_4 +#define MENU_INFO_FONT_FOOT FONT_FOOTER #define MENU_INFO_SPACE_HEAD (menu.headline2_spacing_info[info_mode]) #define MENU_SCREEN_INFO_SPACE_LEFT (menu.left_spacing_info[info_mode]) #define MENU_SCREEN_INFO_SPACE_MIDDLE (menu.middle_spacing_info[info_mode]) @@ -204,7 +207,7 @@ #define MENU_SCREEN_INFO_YBOTTOM (SYSIZE - MENU_SCREEN_INFO_SPACE_BOTTOM) #define MENU_SCREEN_INFO_YSIZE (MENU_SCREEN_INFO_YBOTTOM - \ MENU_SCREEN_INFO_YSTART - TILEY / 2) -#define MENU_SCREEN_INFO_FOOTER MENU_SCREEN_INFO_YBOTTOM +#define MENU_SCREEN_INFO_FOOTER MENU_FOOTER_YPOS #define MAX_INFO_ELEMENTS_IN_ARRAY 128 #define MAX_INFO_ELEMENTS_ON_SCREEN (SYSIZE / TILEY) #define MAX_INFO_ELEMENTS MIN(MAX_INFO_ELEMENTS_IN_ARRAY, \ @@ -5938,7 +5941,7 @@ static void DrawScoreInfo_Content(int entry_nr) int ystep_line = getMenuTextStep(spacing_line, font_text); int xstart = mSX - SX + spacing_left; int ystart = mSY - SY + spacing_top + getHeadlineSpacing(); - int yfooter = mSY - SY + SYSIZE - menu.bottom_spacing[GAME_MODE_SCOREINFO]; + int yfooter = mSY - SY + MENU_FOOTER_YPOS; int xstart1 = xstart + xstep; int xstart2 = xstart + xstep * 12; int select_x = SX + xstart1; @@ -7833,7 +7836,7 @@ static void ToggleNetworkModeIfNeeded(void) int font_title = FONT_TITLE_1; int font_foot = FC_BLUE; int ystart = mSY - SY + 16; - int yfooter = mSY - SY + SYSIZE - 20; + int yfooter = mSY - SY + MENU_FOOTER_YPOS; char *text = (setup.network_mode ? "Start Network" : "Stop Network"); if (setup.network_mode == network.enabled) -- 2.34.1