mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Recalculate animation end position if layout changes after start.
This commit is contained in:
parent
1805484a6f
commit
5d94bb36fb
@ -566,6 +566,42 @@ static void gfx_widget_load_content_animation_layout(
|
||||
(float)font_regular->line_centre_offset;
|
||||
/* > Note: cannot determine state->text_x_end
|
||||
* until text strings are set */
|
||||
|
||||
/* Recalculate end positions if layout changes after start */
|
||||
if (state->status > GFX_WIDGET_LOAD_CONTENT_BEGIN)
|
||||
{
|
||||
int content_name_width;
|
||||
int system_name_width;
|
||||
int text_width;
|
||||
|
||||
/* Get overall text width */
|
||||
content_name_width = font_driver_get_message_width(
|
||||
font_bold->font, state->content_name,
|
||||
strlen(state->content_name), 1.0f);
|
||||
system_name_width = font_driver_get_message_width(
|
||||
font_regular->font, state->system_name,
|
||||
state->system_name_len, 1.0f);
|
||||
|
||||
state->content_name_width = (content_name_width > 0) ?
|
||||
(unsigned)content_name_width : 0;
|
||||
state->system_name_width = (system_name_width > 0) ?
|
||||
(unsigned)system_name_width : 0;
|
||||
|
||||
text_width = (state->content_name_width > state->system_name_width) ?
|
||||
(int)state->content_name_width : (int)state->system_name_width;
|
||||
|
||||
/* Now we have the text width, can determine
|
||||
* final icon/text x draw positions */
|
||||
state->icon_x_end = ((int)last_video_width - text_width -
|
||||
(int)state->icon_size - (3 * (int)widget_padding)) >> 1;
|
||||
if (state->icon_x_end < (int)widget_padding)
|
||||
state->icon_x_end = widget_padding;
|
||||
|
||||
state->text_x_end = state->icon_x_end +
|
||||
(float)(state->icon_size + widget_padding);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Widget iterate() */
|
||||
|
Loading…
x
Reference in New Issue
Block a user