mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-19 01:12:33 +00:00
Font scale option.
This commit is contained in:
parent
c6fc8e45ff
commit
4eab7c4387
@ -170,6 +170,9 @@ static const bool crop_overscan = true;
|
||||
|
||||
// Font size for on-screen messages.
|
||||
static const unsigned font_size = 48;
|
||||
// Attempt to scale the font size.
|
||||
// The scale factor will be window_size / desktop_size.
|
||||
static const bool font_scale = true;
|
||||
|
||||
// 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.05;
|
||||
|
@ -109,6 +109,7 @@ struct settings
|
||||
char font_path[PATH_MAX];
|
||||
unsigned font_size;
|
||||
bool font_enable;
|
||||
bool font_scale;
|
||||
float msg_pos_x;
|
||||
float msg_pos_y;
|
||||
float msg_color_r;
|
||||
|
8
gfx/gl.c
8
gfx/gl.c
@ -756,10 +756,14 @@ static void blit_fonts(gl_t *gl, const struct font_output *head, const struct fo
|
||||
static void calculate_font_coords(gl_t *gl,
|
||||
GLfloat font_vertex[8], GLfloat font_vertex_dark[8], GLfloat font_tex_coords[8])
|
||||
{
|
||||
GLfloat scale_factor = g_settings.video.font_scale ?
|
||||
gl->full_x / gl->vp_width :
|
||||
1.0f;
|
||||
|
||||
GLfloat lx = g_settings.video.msg_pos_x;
|
||||
GLfloat hx = (GLfloat)gl->font_last_width / gl->vp_width + lx;
|
||||
GLfloat hx = (GLfloat)gl->font_last_width / (gl->vp_width * scale_factor) + lx;
|
||||
GLfloat ly = g_settings.video.msg_pos_y;
|
||||
GLfloat hy = (GLfloat)gl->font_last_height / gl->vp_height + ly;
|
||||
GLfloat hy = (GLfloat)gl->font_last_height / (gl->vp_height * scale_factor) + ly;
|
||||
|
||||
font_vertex[0] = lx;
|
||||
font_vertex[1] = ly;
|
||||
|
@ -164,10 +164,11 @@ static void set_defaults(void)
|
||||
g_settings.video.crop_overscan = crop_overscan;
|
||||
g_settings.video.aspect_ratio = -1.0f; // Automatic
|
||||
g_settings.video.shader_type = SSNES_SHADER_AUTO;
|
||||
g_settings.video.font_enable = font_enable;
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
g_settings.video.font_enable = font_enable;
|
||||
g_settings.video.font_size = font_size;
|
||||
g_settings.video.font_scale = font_scale;
|
||||
g_settings.video.msg_pos_x = message_pos_offset_x;
|
||||
g_settings.video.msg_pos_y = message_pos_offset_y;
|
||||
|
||||
@ -366,6 +367,7 @@ static void parse_config_file(void)
|
||||
CONFIG_GET_STRING(video.font_path, "video_font_path");
|
||||
CONFIG_GET_INT(video.font_size, "video_font_size");
|
||||
CONFIG_GET_BOOL(video.font_enable, "video_font_enable");
|
||||
CONFIG_GET_BOOL(video.font_scale, "video_font_scale");
|
||||
CONFIG_GET_DOUBLE(video.msg_pos_x, "video_message_pos_x");
|
||||
CONFIG_GET_DOUBLE(video.msg_pos_y, "video_message_pos_y");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user