mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Move gfx_display_draw_text to retroarch.c and get rid of
video_driver_set_osd_msg
This commit is contained in:
parent
9d6bfabd02
commit
f38eb84cc7
@ -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, ¶ms, (void*)font);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* NOTE: Reads image from file */
|
/* NOTE: Reads image from file */
|
||||||
bool gfx_display_reset_textures_list(
|
bool gfx_display_reset_textures_list(
|
||||||
const char *texture_path, const char *iconpath,
|
const char *texture_path, const char *iconpath,
|
||||||
|
40
retroarch.c
40
retroarch.c
@ -32427,14 +32427,50 @@ bool video_driver_get_video_output_size(unsigned *width, unsigned *height)
|
|||||||
return true;
|
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;
|
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)
|
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,
|
p_rarch->video_driver_poke->set_osd_msg(p_rarch->video_driver_data,
|
||||||
msg, data, font);
|
text, ¶ms, (void*)font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void video_driver_set_texture_enable(bool enable, bool fullscreen)
|
void video_driver_set_texture_enable(bool enable, bool fullscreen)
|
||||||
{
|
{
|
||||||
struct rarch_state *p_rarch = &rarch_st;
|
struct rarch_state *p_rarch = &rarch_st;
|
||||||
|
@ -1591,9 +1591,6 @@ bool video_driver_set_video_mode(unsigned width,
|
|||||||
bool video_driver_get_video_output_size(
|
bool video_driver_get_video_output_size(
|
||||||
unsigned *width, unsigned *height);
|
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_enable(bool enable, bool full_screen);
|
||||||
|
|
||||||
void video_driver_set_texture_frame(const void *frame, bool rgb32,
|
void video_driver_set_texture_frame(const void *frame, bool rgb32,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user