diff --git a/gfx/drivers/vita2d_gfx.c b/gfx/drivers/vita2d_gfx.c index 2bfa36b502..2c893c00bd 100644 --- a/gfx/drivers/vita2d_gfx.c +++ b/gfx/drivers/vita2d_gfx.c @@ -83,6 +83,8 @@ static void *vita2d_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data) { vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t)); + driver_t *driver = driver_get_ptr(); + settings_t *settings = config_get_ptr(); if (!vita) return NULL; @@ -134,6 +136,14 @@ static void *vita2d_gfx_init(const video_info_t *video, #ifdef HAVE_OVERLAY vita->overlay_enable = false; #endif + if (!font_init_first((const void**)&driver->font_osd_driver, &driver->font_osd_data, + vita, *settings->video.font_path + ? settings->video.font_path : NULL, settings->video.font_size, + FONT_DRIVER_RENDER_VITA2D)) + { + RARCH_ERR("Font: Failed to initialize font renderer.\n"); + return false; + } return vita; } @@ -237,6 +247,11 @@ static bool vita2d_gfx_frame(void *data, const void *frame, } } +#ifdef HAVE_OVERLAY + if (vita->overlay_enable) + vita2d_render_overlay(vita); +#endif + if (vita->menu.active && vita->menu.texture) { if (vita->fullscreen) @@ -265,11 +280,14 @@ static bool vita2d_gfx_frame(void *data, const void *frame, } } -#ifdef HAVE_OVERLAY - if (vita->overlay_enable) - vita2d_render_overlay(vita); -#endif - + if(msg&&strcmp(msg,"")){ + driver_t *driver = driver_get_ptr(); + const font_renderer_t *font_ctx = driver->font_osd_driver; + + if (font_ctx->render_msg) + font_ctx->render_msg(driver->font_osd_data, msg, NULL); + } + vita2d_end_drawing(); vita2d_swap_buffers(); @@ -600,7 +618,7 @@ static const video_poke_interface_t vita_poke_interface = { NULL, NULL, NULL -}; + }; static void vita2d_gfx_get_poke_interface(void *data, const video_poke_interface_t **iface) diff --git a/gfx/drivers_font/vita2d_font.c b/gfx/drivers_font/vita2d_font.c index 57ec046d40..beb70b38bc 100644 --- a/gfx/drivers_font/vita2d_font.c +++ b/gfx/drivers_font/vita2d_font.c @@ -76,18 +76,14 @@ static void vita2d_font_render_msg(void *data, const char *msg, { x = settings->video.msg_pos_x; y = 0.90f; - scale = 1.04f; - color = SILVER; + scale = 0.8f; + color = YELLOW; } - - vita2d_font_draw_text(vita->font, x, y, color, vita->size*scale, msg); - - if (!params) - vita2d_font_draw_text(vita->font, x, y, color, vita->size*(scale - 0.01f), msg); - + + vita2d_font_draw_text(vita->font, x, y, color, vita->size*scale, msg); } -font_renderer_t vita2d_font_renderer = { +font_renderer_t vita2d_vita_font = { vita2d_font_init_font, vita2d_font_free_font, vita2d_font_render_msg, diff --git a/gfx/font_driver.c b/gfx/font_driver.c index be73ac176e..fc0a386284 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -82,6 +82,33 @@ static bool gl_font_init_first( } #endif +#ifdef HAVE_VITA2D +static const font_renderer_t *vita2d_font_backends[] = { + &vita2d_vita_font +}; + +static bool vita2d_font_init_first( + const void **font_driver, void **font_handle, + void *video_data, const char *font_path, float font_size) +{ + unsigned i; + + for (i = 0; vita2d_font_backends[i]; i++) + { + void *data = vita2d_font_backends[i]->init(video_data, font_path, font_size); + + if (!data) + continue; + + *font_driver = vita2d_font_backends[i]; + *font_handle = data; + return true; + } + + return false; +} +#endif + bool font_init_first(const void **font_driver, void **font_handle, void *video_data, const char *font_path, float font_size, enum font_driver_render_api api) @@ -100,6 +127,11 @@ bool font_init_first(const void **font_driver, void **font_handle, case FONT_DRIVER_RENDER_OPENGL_API: return gl_font_init_first(font_driver, font_handle, video_data, font_path, font_size); +#endif +#ifdef HAVE_VITA2D + case FONT_DRIVER_RENDER_VITA2D: + return vita2d_font_init_first(font_driver, font_handle, + video_data, font_path, font_size); #endif case FONT_DRIVER_RENDER_DONT_CARE: /* TODO/FIXME - lookup graphics driver's 'API' */ diff --git a/gfx/font_driver.h b/gfx/font_driver.h index fa9e1b664a..0bb8d61ea8 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -29,7 +29,8 @@ enum font_driver_render_api { FONT_DRIVER_RENDER_DONT_CARE, FONT_DRIVER_RENDER_OPENGL_API, - FONT_DRIVER_RENDER_DIRECT3D_API + FONT_DRIVER_RENDER_DIRECT3D_API, + FONT_DRIVER_RENDER_VITA2D }; bool font_init_first( @@ -42,4 +43,3 @@ bool font_init_first( #endif #endif - diff --git a/gfx/font_renderer_driver.h b/gfx/font_renderer_driver.h index 44a3d87381..ef80475ddd 100644 --- a/gfx/font_renderer_driver.h +++ b/gfx/font_renderer_driver.h @@ -79,6 +79,7 @@ extern font_renderer_t libdbg_font; extern font_renderer_t d3d_xbox360_font; extern font_renderer_t d3d_xdk1_font; extern font_renderer_t d3d_win32_font; +extern font_renderer_t vita2d_vita_font; typedef struct font_renderer_driver {