Move gfx_display_draw_text to retroarch.c and get rid of

video_driver_set_osd_msg
This commit is contained in:
twinaphex 2020-09-28 03:38:16 +02:00
parent 9d6bfabd02
commit f38eb84cc7
3 changed files with 38 additions and 45 deletions

View File

@ -1608,46 +1608,6 @@ void gfx_display_draw_keyboard(
}
}
/* Draw text on top of the screen */
void gfx_display_draw_text(
const font_data_t *font, const char *text,
float x, float y, int width, int height,
uint32_t color, enum text_alignment text_align,
float scale, bool shadows_enable, float shadow_offset,
bool draw_outside)
{
struct font_params params;
if ((color & 0x000000FF) == 0)
return;
/* Don't draw outside of the screen */
if (!draw_outside &&
((x < -64 || x > width + 64)
|| (y < -64 || y > height + 64))
)
return;
params.x = x / width;
params.y = 1.0f - y / height;
params.scale = scale;
params.drop_mod = 0.0f;
params.drop_x = 0.0f;
params.drop_y = 0.0f;
params.color = color;
params.full_screen = true;
params.text_align = text_align;
if (shadows_enable)
{
params.drop_x = shadow_offset;
params.drop_y = -shadow_offset;
params.drop_alpha = 0.35f;
}
video_driver_set_osd_msg(text, &params, (void*)font);
}
/* NOTE: Reads image from file */
bool gfx_display_reset_textures_list(
const char *texture_path, const char *iconpath,

View File

@ -32427,14 +32427,50 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
return true;
}
void video_driver_set_osd_msg(const char *msg, const void *data, void *font)
/* Draw text on top of the screen */
void gfx_display_draw_text(
const font_data_t *font, const char *text,
float x, float y, int width, int height,
uint32_t color, enum text_alignment text_align,
float scale, bool shadows_enable, float shadow_offset,
bool draw_outside)
{
struct font_params params;
struct rarch_state *p_rarch = &rarch_st;
if ((color & 0x000000FF) == 0)
return;
/* Don't draw outside of the screen */
if (!draw_outside &&
((x < -64 || x > width + 64)
|| (y < -64 || y > height + 64))
)
return;
params.x = x / width;
params.y = 1.0f - y / height;
params.scale = scale;
params.drop_mod = 0.0f;
params.drop_x = 0.0f;
params.drop_y = 0.0f;
params.color = color;
params.full_screen = true;
params.text_align = text_align;
if (shadows_enable)
{
params.drop_x = shadow_offset;
params.drop_y = -shadow_offset;
params.drop_alpha = 0.35f;
}
if (p_rarch->video_driver_poke && p_rarch->video_driver_poke->set_osd_msg)
p_rarch->video_driver_poke->set_osd_msg(p_rarch->video_driver_data,
msg, data, font);
text, &params, (void*)font);
}
void video_driver_set_texture_enable(bool enable, bool fullscreen)
{
struct rarch_state *p_rarch = &rarch_st;

View File

@ -1591,9 +1591,6 @@ bool video_driver_set_video_mode(unsigned width,
bool video_driver_get_video_output_size(
unsigned *width, unsigned *height);
void video_driver_set_osd_msg(const char *msg,
const void *params, void *font);
void video_driver_set_texture_enable(bool enable, bool full_screen);
void video_driver_set_texture_frame(const void *frame, bool rgb32,