mirror of
https://github.com/libretro/RetroArch
synced 2025-03-22 16:20:58 +00:00
Configurable message positioning.
This commit is contained in:
parent
21b9f57af1
commit
e5fd3b95fa
@ -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)
|
||||
|
||||
////////////////
|
||||
|
@ -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;
|
||||
|
||||
|
8
gfx/gl.c
8
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;
|
||||
|
10
settings.c
10
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user