mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 21:40:49 +00:00
Add configurable font path/font size.
This commit is contained in:
parent
4e78b80343
commit
21b9f57af1
@ -100,6 +100,9 @@ static const bool video_smooth = true;
|
||||
// On resize and fullscreen, rendering area will stay 4:3
|
||||
static const bool force_aspect = true;
|
||||
|
||||
// Font size for on-screen messages.
|
||||
static const unsigned font_size = 48;
|
||||
|
||||
#define SNES_ASPECT_RATIO (4.0/3)
|
||||
|
||||
////////////////
|
||||
|
@ -54,6 +54,10 @@ struct settings
|
||||
char cg_shader_path[256];
|
||||
char bsnes_shader_path[256];
|
||||
unsigned filter;
|
||||
#ifdef HAVE_FREETYPE
|
||||
char font_path[256];
|
||||
unsigned font_size;
|
||||
#endif
|
||||
} video;
|
||||
|
||||
struct
|
||||
@ -111,7 +115,7 @@ struct global
|
||||
#ifdef HAVE_CONFIGFILE
|
||||
char config_path[256];
|
||||
#endif
|
||||
|
||||
|
||||
char basename[256];
|
||||
char savefile_name_srm[256];
|
||||
char savefile_name_rtc[512]; // Make sure that fill_pathname has space.
|
||||
|
6
gfx/gl.c
6
gfx/gl.c
@ -173,10 +173,10 @@ static inline void gl_shader_set_params(unsigned width, unsigned height,
|
||||
///////////////////
|
||||
|
||||
//////////////// Message rendering
|
||||
static inline void gl_init_font(gl_t *gl, const char *font_path)
|
||||
static inline void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size)
|
||||
{
|
||||
#ifdef HAVE_FREETYPE
|
||||
gl->font = font_renderer_new(font_path, 48);
|
||||
gl->font = font_renderer_new(font_path, font_size);
|
||||
if (gl->font)
|
||||
{
|
||||
glGenTextures(1, &gl->font_tex);
|
||||
@ -535,7 +535,7 @@ static void* gl_init(video_info_t *video, const input_driver_t **input, void **i
|
||||
else
|
||||
*input = NULL;
|
||||
|
||||
gl_init_font(gl, "/usr/share/fonts/TTF/DroidSans.ttf");
|
||||
gl_init_font(gl, g_settings.video.font_path, g_settings.video.font_size);
|
||||
|
||||
if (!gl_check_error())
|
||||
{
|
||||
|
17
settings.c
17
settings.c
@ -102,6 +102,11 @@ static void set_defaults(void)
|
||||
g_settings.video.filter = FILTER_NONE;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FREETYPE
|
||||
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;
|
||||
#endif
|
||||
|
||||
g_settings.audio.enable = audio_enable;
|
||||
g_settings.audio.out_rate = out_rate;
|
||||
g_settings.audio.in_rate = in_rate;
|
||||
@ -232,10 +237,20 @@ static void parse_config_file(void)
|
||||
|
||||
if (config_get_string(conf, "video_bsnes_shader", &tmp_str))
|
||||
{
|
||||
strncpy(g_settings.video.bsnes_shader_path, tmp_str, sizeof(g_settings.video.bsnes_shader_path));
|
||||
strncpy(g_settings.video.bsnes_shader_path, tmp_str, sizeof(g_settings.video.bsnes_shader_path) - 1);
|
||||
free(tmp_str);
|
||||
}
|
||||
|
||||
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);
|
||||
free(tmp_str);
|
||||
}
|
||||
|
||||
if (config_get_int(conf, "video_font_size", &tmp_int))
|
||||
g_settings.video.font_size = tmp_int;
|
||||
|
||||
|
||||
#ifdef HAVE_FILTER
|
||||
if (config_get_string(conf, "video_filter", &tmp_str))
|
||||
{
|
||||
|
4
ssnes.c
4
ssnes.c
@ -674,7 +674,7 @@ int main(int argc, char *argv[])
|
||||
bool should_savestate = driver.input->key_pressed(driver.input_data, SSNES_SAVE_STATE_KEY);
|
||||
if (should_savestate && !old_should_savestate)
|
||||
{
|
||||
msg_queue_push(g_extern.msg_queue, "Saving state! :D", 1, 180);
|
||||
msg_queue_push(g_extern.msg_queue, "Saving state! ^_^", 1, 180);
|
||||
save_state(g_extern.savestate_name);
|
||||
}
|
||||
old_should_savestate = should_savestate;
|
||||
@ -683,7 +683,7 @@ int main(int argc, char *argv[])
|
||||
bool should_loadstate = driver.input->key_pressed(driver.input_data, SSNES_LOAD_STATE_KEY);
|
||||
if (!should_savestate && should_loadstate && !old_should_loadstate)
|
||||
{
|
||||
msg_queue_push(g_extern.msg_queue, "Loading state! :D", 1, 180);
|
||||
msg_queue_push(g_extern.msg_queue, "Loading state! ^_^", 1, 180);
|
||||
load_state(g_extern.savestate_name);
|
||||
}
|
||||
old_should_loadstate = should_loadstate;
|
||||
|
Loading…
x
Reference in New Issue
Block a user