added configuration options for menu footer text position and font
authorHolger Schemel <holger.schemel@virtion.de>
Sun, 3 Nov 2024 10:40:26 +0000 (11:40 +0100)
committerHolger Schemel <holger.schemel@virtion.de>
Sun, 3 Nov 2024 10:40:28 +0000 (11:40 +0100)
src/conf_gfx.c
src/main.c
src/main.h
src/screens.c

index 1db6da648382c6353145d9b9d9cb548209d37abf..c82d86408b0f9291f5ad4089ea413acf9ea04723 100644 (file)
@@ -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"                            },
index 24e3ffd857d576185e87e1112e4df8253810fde7..bf0e68ceb22bc9dac109d7622f56b2ccb86cfcf4 100644 (file)
@@ -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"              },
index 9ca6638ec5644e7ebae8739481649505c92fdb06..449240a4727c95bf45f643a8b03558fec509e55a 100644 (file)
@@ -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
index 97792de9e5d96138408996ed0ab6bf1eae84aae6..c82fde4fb15a9def8a9ec375bd8d0b144dbf5dfb 100644 (file)
 #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])
 #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)