mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 18:50:29 +00:00
Adding gl_get_message_width to gl_raster_font
This commit is contained in:
parent
efd3f7cc58
commit
197a505e4c
@ -126,8 +126,12 @@ static void gl_raster_font_free_font(void *data)
|
||||
free(font);
|
||||
}
|
||||
|
||||
static int get_message_width(gl_raster_t *font, const char *msg, float scale)
|
||||
static int gl_get_message_width(void *data, const char *msg, float scale)
|
||||
{
|
||||
gl_raster_t *font = (gl_raster_t*)data;
|
||||
if (!font)
|
||||
return 0;
|
||||
|
||||
unsigned i;
|
||||
unsigned msg_len_full = strlen(msg);
|
||||
unsigned msg_len = min(msg_len_full, MAX_MSG_LEN_CHUNK);
|
||||
@ -194,10 +198,10 @@ static void gl_raster_font_render_message(
|
||||
switch (text_align)
|
||||
{
|
||||
case TEXT_ALIGN_RIGHT:
|
||||
x -= get_message_width(font, msg, scale);
|
||||
x -= gl_get_message_width(font, msg, scale);
|
||||
break;
|
||||
case TEXT_ALIGN_CENTER:
|
||||
x -= get_message_width(font, msg, scale) / 2.0;
|
||||
x -= gl_get_message_width(font, msg, scale) / 2.0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -408,5 +412,5 @@ font_renderer_t gl_raster_font = {
|
||||
gl_raster_font_get_glyph,
|
||||
gl_raster_font_bind_block,
|
||||
gl_raster_font_flush_block,
|
||||
NULL /* get_message_width */
|
||||
gl_get_message_width
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user