Create menu_display_draw_text

This commit is contained in:
twinaphex 2016-04-20 06:56:19 +02:00
parent 4325a323e5
commit a1969de2c3
4 changed files with 26 additions and 16 deletions

View File

@ -243,16 +243,12 @@ static void mui_draw_tab(mui_handle_t *mui,
}
static void mui_blit_line(float x, float y, unsigned width, unsigned height,
const char *message, uint32_t color, enum text_alignment text_align)
const char *msg, uint32_t color, enum text_alignment text_align)
{
int font_size;
struct font_params params;
void *fb_buf = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
params.x = x / width;
params.y = 1.0f - (y + font_size / 3) / height;
params.x = x;
params.y = y;
params.scale = 1.0f;
params.drop_mod = 0.0f;
params.drop_x = 0.0f;
@ -261,9 +257,7 @@ static void mui_blit_line(float x, float y, unsigned width, unsigned height,
params.full_screen = true;
params.text_align = text_align;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &fb_buf);
video_driver_set_osd_msg(message, &params, fb_buf);
menu_display_draw_text(msg, width, height, &params);
}
static void mui_render_quad(mui_handle_t *mui,

View File

@ -499,7 +499,6 @@ static void xmb_draw_text(xmb_handle_t *xmb,
settings_t *settings = config_get_ptr();
struct font_params params;
uint8_t a8 = 0;
void *disp_buf = NULL;
if (alpha > xmb->alpha)
alpha = xmb->alpha;
@ -513,8 +512,8 @@ static void xmb_draw_text(xmb_handle_t *xmb,
|| y < -xmb->icon.size || y > height + xmb->icon.size)
return;
params.x = x / width;
params.y = 1.0f - y / height;
params.x = x;
params.y = y;
params.scale = scale_factor;
params.drop_mod = 0.0f;
params.drop_x = 0.0f;
@ -530,9 +529,7 @@ static void xmb_draw_text(xmb_handle_t *xmb,
params.drop_alpha = 0.25f;
}
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &disp_buf);
video_driver_set_osd_msg(str, &params, disp_buf);
menu_display_draw_text(str, width, height, &params);
}
static void xmb_messagebox(void *data, const char *message)

View File

@ -780,3 +780,19 @@ void menu_display_snow(int width, int height)
j++;
}
}
void menu_display_draw_text(const char *msg,
int width, int height, struct font_params *params)
{
int font_size;
void *fb_buf = NULL;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_SIZE, &font_size);
params->x = params->x / width;
params->y = 1.0f - (params->y + font_size / 3) / height;
menu_display_ctl(MENU_DISPLAY_CTL_FONT_BUF, &fb_buf);
video_driver_set_osd_msg(msg, params, fb_buf);
}

View File

@ -191,6 +191,9 @@ void menu_display_draw_cursor(
float *color, float cursor_size, uintptr_t texture,
float x, float y, unsigned width, unsigned height);
void menu_display_draw_text(const char *msg, int width, int height,
struct font_params *params);
extern uintptr_t menu_display_white_texture;
extern menu_display_ctx_driver_t menu_display_ctx_gl;