video_font_enable.

This commit is contained in:
Themaister 2011-11-10 00:15:41 +01:00
parent 477091ce8f
commit 51721b4cb6
8 changed files with 27 additions and 6 deletions

View File

@ -156,6 +156,9 @@ static const bool hires_record = false;
// Record post-filtered (CPU filter) video rather than raw SNES output.
static const bool post_filter_record = false;
// OSD-messages
static const bool font_enable = true;
////////////////
// Audio
////////////////

View File

@ -96,6 +96,7 @@ struct settings
char font_path[MAXPATHLEN];
unsigned font_size;
bool font_enable;
float msg_pos_x;
float msg_pos_y;
float msg_color_r;

View File

@ -246,15 +246,18 @@ static bool setup_video(ext_t *ext, const video_info_t *video, const input_drive
font_color_b = font_color_b > 255 ? 255 : (font_color_b < 0 ? 0 : font_color_b);
const char *font = NULL;
if (g_settings.video.font_enable)
{
#ifdef HAVE_FREETYPE
if (*g_settings.video.font_path)
font = g_settings.video.font_path;
else
font = font_renderer_get_default_font();
if (*g_settings.video.font_path)
font = g_settings.video.font_path;
else
font = font_renderer_get_default_font();
#else
font = *g_settings.video.font_path ?
g_settings.video.font_path : NULL;
font = *g_settings.video.font_path ?
g_settings.video.font_path : NULL;
#endif
}
char title_buf[128];
gfx_window_title_reset();

View File

@ -337,6 +337,9 @@ static void gl_shader_scale(unsigned index, struct gl_fbo_scale *scale)
static inline void gl_init_font(gl_t *gl, const char *font_path, unsigned font_size)
{
#ifdef HAVE_FREETYPE
if (!g_settings.video.font_enable)
return;
const char *path = font_path;
if (!*path)
path = font_renderer_get_default_font();

View File

@ -80,6 +80,9 @@ static void sdl_gfx_free(void *data)
static void sdl_init_font(sdl_video_t *vid, const char *font_path, unsigned font_size)
{
#ifdef HAVE_FREETYPE
if (!g_settings.video.font_enable)
return;
const char *path = font_path;
if (!*path)
path = font_renderer_get_default_font();

View File

@ -184,6 +184,9 @@ static void set_fullscreen(xv_t *xv)
static void xv_init_font(xv_t *xv, const char *font_path, unsigned font_size)
{
#ifdef HAVE_FREETYPE
if (!g_settings.video.font_enable)
return;
const char *path = font_path;
if (!*path)
path = font_renderer_get_default_font();

View File

@ -131,6 +131,7 @@ 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_size = font_size;
@ -328,6 +329,7 @@ static void parse_config_file(void)
#ifdef HAVE_FREETYPE
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_DOUBLE(video.msg_pos_x, "video_message_pos_x");
CONFIG_GET_DOUBLE(video.msg_pos_y, "video_message_pos_y");

View File

@ -89,6 +89,9 @@
# Size of the TTF font rendered.
# video_font_size = 48
# Enable usage of OSD messages.
# video_font_enable = true
# Offset for where messages will be placed on screen. Values are in range 0.0 to 1.0 for both x and y values.
# [0.0, 0.0] maps to the lower left corner of the screen.
# video_message_pos_x = 0.05