diff --git a/config.def.h b/config.def.h index 58eafe2fc5..c8d8635139 100644 --- a/config.def.h +++ b/config.def.h @@ -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) //////////////// diff --git a/general.h b/general.h index b27dc4c4d4..5f4b708f45 100644 --- a/general.h +++ b/general.h @@ -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. diff --git a/gfx/gl.c b/gfx/gl.c index 1acd1722b8..5e06e812c6 100644 --- a/gfx/gl.c +++ b/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()) { diff --git a/settings.c b/settings.c index 509b5a4efc..02f736e533 100644 --- a/settings.c +++ b/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)) { diff --git a/ssnes.c b/ssnes.c index ef8da2be59..547d22780f 100644 --- a/ssnes.c +++ b/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; diff --git a/ssnes.cfg b/ssnes.cfg index d2e372aef2..75fc69a5d1 100644 --- a/ssnes.cfg +++ b/ssnes.cfg @@ -37,6 +37,12 @@ # CPU-based filter. Valid ones are: hq2x, hq4x, grayscale, bleed, ntsc. # video_filter = ntsc +# Path to a TTF font used for rendering messages. +# video_font_path = + +# Size of the TTF font rendered. +# video_font_size = 48 + #### Audio # Enable audio.