diff --git a/config.def.h b/config.def.h index c8d8635139..d3c6b4b2b4 100644 --- a/config.def.h +++ b/config.def.h @@ -103,6 +103,10 @@ static const bool force_aspect = true; // Font size for on-screen messages. static const unsigned font_size = 48; +// Offset for where messages will be placed on-screen. Values are in range [0.0, 1.0]. +static const float message_pos_offset_x = 0.3; +static const float message_pos_offset_y = 0.3; + #define SNES_ASPECT_RATIO (4.0/3) //////////////// diff --git a/general.h b/general.h index 5f4b708f45..b4d013a4ea 100644 --- a/general.h +++ b/general.h @@ -57,6 +57,8 @@ struct settings #ifdef HAVE_FREETYPE char font_path[256]; unsigned font_size; + float msg_pos_x; + float msg_pos_y; #endif } video; diff --git a/gfx/gl.c b/gfx/gl.c index 5e06e812c6..2cfd24bbde 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -239,10 +239,10 @@ static void gl_render_msg(gl_t *gl, const char *msg) while (head != NULL) { - GLfloat lx = (GLfloat)head->off_x / gl->vp_width + 0.05; - GLfloat hx = (GLfloat)(head->off_x + head->width) / gl->vp_width + 0.05; - GLfloat ly = (GLfloat)head->off_y / gl->vp_height + 0.05; - GLfloat hy = (GLfloat)(head->off_y + head->height) / gl->vp_height + 0.05; + GLfloat lx = (GLfloat)head->off_x / gl->vp_width + g_settings.video.msg_pos_x; + GLfloat hx = (GLfloat)(head->off_x + head->width) / gl->vp_width + g_settings.video.msg_pos_x; + GLfloat ly = (GLfloat)head->off_y / gl->vp_height + g_settings.video.msg_pos_y; + GLfloat hy = (GLfloat)(head->off_y + head->height) / gl->vp_height + g_settings.video.msg_pos_y; font_vertex[0] = lx; font_vertex[1] = ly; diff --git a/settings.c b/settings.c index 02f736e533..002ffa6749 100644 --- a/settings.c +++ b/settings.c @@ -103,8 +103,11 @@ static void set_defaults(void) #endif #ifdef HAVE_FREETYPE + // Just grab one font path for now... :) strncpy(g_settings.video.font_path, "/usr/share/fonts/TTF/DejaVuSans.ttf", sizeof(g_settings.video.font_path) - 1); g_settings.video.font_size = font_size; + g_settings.video.msg_pos_x = message_pos_offset_x; + g_settings.video.msg_pos_y = message_pos_offset_y; #endif g_settings.audio.enable = audio_enable; @@ -241,6 +244,7 @@ static void parse_config_file(void) free(tmp_str); } +#ifdef HAVE_FREETYPE if (config_get_string(conf, "video_font_path", &tmp_str)) { strncpy(g_settings.video.font_path, tmp_str, sizeof(g_settings.video.font_path) - 1); @@ -250,6 +254,12 @@ static void parse_config_file(void) if (config_get_int(conf, "video_font_size", &tmp_int)) g_settings.video.font_size = tmp_int; + if (config_get_double(conf, "video_message_pos_x", &tmp_double)) + g_settings.video.msg_pos_x = tmp_double; + if (config_get_double(conf, "video_message_pos_y", &tmp_double)) + g_settings.video.msg_pos_y = tmp_double; +#endif + #ifdef HAVE_FILTER if (config_get_string(conf, "video_filter", &tmp_str)) diff --git a/ssnes.cfg b/ssnes.cfg index 75fc69a5d1..cf830dc4be 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -43,6 +43,10 @@ # Size of the TTF font rendered. # video_font_size = 48 +# Offset for where messages will be placed on screen. Values are in range 0.0 to 1.0 for both x and y values. +# video_message_pos_x = 0.3 +# video_message_pox_y = 0.3 + #### Audio # Enable audio.