From 6b748c845ff51daac061662d016447e122cf6fb3 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 3 Dec 2015 09:56:34 +0100 Subject: [PATCH] changed default title message position and size to be dynamically determined --- src/conf_gfx.c | 16 ++++++++-------- src/screens.c | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 503f2b32..880d0632 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5894,10 +5894,10 @@ struct ConfigInfo image_config[] = { "[title].post_delay", "250" }, { "[title].auto_delay", "-1" }, - { "[titlemessage_initial].x", "336" }, - { "[titlemessage_initial].y", "280" }, - { "[titlemessage_initial].width", "640" }, - { "[titlemessage_initial].height", "512" }, + { "[titlemessage_initial].x", "-1" }, + { "[titlemessage_initial].y", "-1" }, + { "[titlemessage_initial].width", "-1" }, + { "[titlemessage_initial].height", "-1" }, { "[titlemessage_initial].chars", "-1" }, { "[titlemessage_initial].lines", "-1" }, { "[titlemessage_initial].align", "center" }, @@ -5911,10 +5911,10 @@ struct ConfigInfo image_config[] = { "[titlemessage_initial].fade_delay", ARG_DEFAULT }, { "[titlemessage_initial].post_delay", ARG_DEFAULT }, { "[titlemessage_initial].auto_delay", ARG_DEFAULT }, - { "[titlemessage].x", "336" }, - { "[titlemessage].y", "280" }, - { "[titlemessage].width", "640" }, - { "[titlemessage].height", "512" }, + { "[titlemessage].x", "-1" }, + { "[titlemessage].y", "-1" }, + { "[titlemessage].width", "-1" }, + { "[titlemessage].height", "-1" }, { "[titlemessage].chars", "-1" }, { "[titlemessage].lines", "-1" }, { "[titlemessage].align", "center" }, diff --git a/src/screens.c b/src/screens.c index e68ec1a8..30214464 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1308,6 +1308,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) /* force TITLE font on title message screen */ game_status = getTitleMessageGameMode(initial); + /* if chars *and* width set to "-1", automatically determine width */ + if (tmi->chars == -1 && tmi->width == -1) + tmi->width = viewport.window[game_status].width; + + /* if lines *and* height set to "-1", automatically determine height */ + if (tmi->lines == -1 && tmi->height == -1) + tmi->height = viewport.window[game_status].height; + /* if chars set to "-1", automatically determine by text and font width */ if (tmi->chars == -1) tmi->chars = tmi->width / getFontWidth(tmi->font); @@ -1320,6 +1328,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) else tmi->height = tmi->lines * getFontHeight(tmi->font); + /* if x set to "-1", automatically determine by width and alignment */ + if (tmi->x == -1) + tmi->x = -1 * ALIGNED_XPOS(0, tmi->width, tmi->align); + + /* if y set to "-1", automatically determine by height and alignment */ + if (tmi->y == -1) + tmi->y = -1 * ALIGNED_YPOS(0, tmi->height, tmi->valign); + SetDrawBackgroundMask(REDRAW_ALL); SetWindowBackgroundImage(getTitleBackground(nr, initial, FALSE)); -- 2.34.1