Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor widget alignments #16288

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions gfx/gfx_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ static void gfx_widgets_layout(
bool is_threaded, const char *dir_assets, char *font_path)
{
size_t i;
unsigned msg_queue_padding;

/* Initialise fonts */
if (string_is_empty(font_path))
Expand Down Expand Up @@ -866,6 +867,7 @@ static void gfx_widgets_layout(
p_dispwidget->simple_widget_height = p_dispwidget->gfx_widget_fonts.regular.line_height + p_dispwidget->simple_widget_padding;

p_dispwidget->msg_queue_height = p_dispwidget->gfx_widget_fonts.msg_queue.line_height * 2.333f * (BASE_FONT_SIZE / MSG_QUEUE_FONT_SIZE);
msg_queue_padding = (unsigned)(((float)p_dispwidget->gfx_widget_fonts.msg_queue.line_height * (2.0f / 3.0f)) + 0.5f);

if (p_dispwidget->flags & DISPGFX_WIDGET_FLAG_MSG_QUEUE_HAS_ICONS)
{
Expand All @@ -885,7 +887,7 @@ static void gfx_widgets_layout(
}

p_dispwidget->msg_queue_spacing = p_dispwidget->msg_queue_height / 4.0f;
p_dispwidget->msg_queue_rect_start_x = ceilf(p_dispwidget->msg_queue_spacing / 2.0f + p_dispwidget->msg_queue_icon_size_x + (p_dispwidget->simple_widget_padding / 4.0f));
p_dispwidget->msg_queue_rect_start_x = ceil((msg_queue_padding * 2.0f) - (p_dispwidget->simple_widget_padding * 0.15f));
p_dispwidget->msg_queue_internal_icon_size = p_dispwidget->msg_queue_icon_size_y;
p_dispwidget->msg_queue_internal_icon_offset = (p_dispwidget->msg_queue_icon_size_y - p_dispwidget->msg_queue_internal_icon_size) / 2;
p_dispwidget->msg_queue_icon_offset_y = (p_dispwidget->msg_queue_icon_size_y - p_dispwidget->msg_queue_height) / 2;
Expand All @@ -896,14 +898,14 @@ static void gfx_widgets_layout(
else
p_dispwidget->msg_queue_regular_padding_x = p_dispwidget->simple_widget_padding;

p_dispwidget->msg_queue_task_rect_start_x = p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x;
p_dispwidget->msg_queue_task_rect_start_x = p_dispwidget->msg_queue_rect_start_x;

p_dispwidget->msg_queue_task_text_start_x = p_dispwidget->msg_queue_task_rect_start_x + (p_dispwidget->msg_queue_height / 2.0f) + (p_dispwidget->simple_widget_padding / 2.0f);

if (!p_dispwidget->gfx_widgets_icons_textures[MENU_WIDGETS_ICON_HOURGLASS])
p_dispwidget->msg_queue_task_text_start_x -= p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width * 2.0f;

p_dispwidget->msg_queue_regular_text_start = p_dispwidget->msg_queue_rect_start_x + (p_dispwidget->simple_widget_padding / 2.5f);
p_dispwidget->msg_queue_regular_text_start = p_dispwidget->msg_queue_rect_start_x + p_dispwidget->msg_queue_icon_size_x + (p_dispwidget->simple_widget_padding / 2.5f);

p_dispwidget->msg_queue_task_hourglass_x = p_dispwidget->msg_queue_task_rect_start_x + (p_dispwidget->simple_widget_padding / 2.5f);

Expand Down Expand Up @@ -1230,7 +1232,7 @@ static void gfx_widgets_draw_task_msg(
msg_queue_current_background = msg_queue_task_progress_2;
}

rect_x = p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x;
rect_x = p_dispwidget->msg_queue_rect_start_x;
rect_y = video_height - msg->offset_y;
rect_height = p_dispwidget->msg_queue_height / 2;
rect_margin = p_dispwidget->simple_widget_padding * 0.15f;
Expand Down Expand Up @@ -1378,7 +1380,7 @@ static void gfx_widgets_draw_task_msg(
text_color = COLOR_TEXT_ALPHA(0xFFFFFF00, (unsigned)(msg->alpha/2*255.0f));
gfx_widgets_draw_text(&p_dispwidget->gfx_widget_fonts.msg_queue,
task_percentage,
p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x
p_dispwidget->msg_queue_rect_start_x
+ rect_width - p_dispwidget->gfx_widget_fonts.msg_queue.glyph_width,
text_y_base,
video_width, video_height,
Expand Down Expand Up @@ -1444,7 +1446,7 @@ static void gfx_widgets_draw_regular_msg(
userdata,
video_width,
video_height,
p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x + rect_margin,
p_dispwidget->msg_queue_rect_start_x + rect_margin,
video_height - msg->offset_y,
rect_width - rect_margin,
p_dispwidget->msg_queue_height,
Expand All @@ -1459,7 +1461,7 @@ static void gfx_widgets_draw_regular_msg(
userdata,
video_width,
video_height,
p_dispwidget->msg_queue_rect_start_x - p_dispwidget->msg_queue_icon_size_x,
p_dispwidget->msg_queue_rect_start_x,
video_height - msg->offset_y,
rect_margin,
p_dispwidget->msg_queue_height,
Expand Down Expand Up @@ -1508,7 +1510,6 @@ static void gfx_widgets_draw_regular_msg(
p_dispwidget->msg_queue_icon_size_y,
p_dispwidget->gfx_widgets_icons_textures[MENU_WIDGETS_ICON_INFO],
p_dispwidget->msg_queue_rect_start_x
- p_dispwidget->msg_queue_icon_size_x
+ (p_dispwidget->simple_widget_padding / 4.0f),
video_height - msg->offset_y - p_dispwidget->msg_queue_icon_offset_y,
0.0f, /* rad */
Expand Down
2 changes: 1 addition & 1 deletion gfx/widgets/gfx_widget_libretro_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ static void gfx_widget_libretro_message_layout(
state->frame_width = divider_width;

/* X-alignment with other widget types */
state->bg_x = (float)state->text_padding * 1.33f;
state->bg_x = (float)state->text_padding * 2.0f;
state->bg_y_start = (float)last_video_height + (float)state->frame_width;
state->bg_y_end = (float)last_video_height - (float)state->bg_height;
state->text_x = state->bg_x + (float)state->text_padding;
Expand Down
Loading