Rewrite ozone_draw_text

This commit is contained in:
twinaphex 2020-08-31 04:13:23 +02:00
parent 147d420885
commit 201f119c51
5 changed files with 21 additions and 28 deletions

View File

@ -2010,7 +2010,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
gfx_animation_ticker(&ticker);
}
ozone_draw_text(ozone, title,
ozone_draw_text(title,
ticker_x_offset + 128 * scale_factor,
ozone->dimensions.header_height / 2 + ozone->fonts.title.line_centre_offset,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.title, ozone->theme->text_rgba, false);
@ -2064,7 +2064,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
{
timedate_offset = 95 * scale_factor;
ozone_draw_text(ozone, msg,
ozone_draw_text(msg,
video_width - 85 * scale_factor,
ozone->dimensions.header_height / 2 + ozone->fonts.time.line_centre_offset,
TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.time, ozone->theme->text_rgba, false);
@ -2101,7 +2101,7 @@ static void ozone_draw_header(ozone_handle_t *ozone,
menu_display_timedate(&datetime);
ozone_draw_text(ozone, timedate,
ozone_draw_text(timedate,
video_width - (85 * scale_factor) - timedate_offset,
ozone->dimensions.header_height / 2 + ozone->fonts.time.line_centre_offset,
TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.time, ozone->theme->text_rgba, false);
@ -2274,21 +2274,21 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
/* Draw labels */
/* > ok */
ozone_draw_text(ozone,
ozone_draw_text(
ozone->footer_labels.ok.str,
ok_x + icon_size + icon_padding,
footer_text_y,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.footer, ozone->theme->text_rgba, false);
/* > back */
ozone_draw_text(ozone,
ozone_draw_text(
ozone->footer_labels.back.str,
back_x + icon_size + icon_padding,
footer_text_y,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.footer, ozone->theme->text_rgba, false);
/* > search */
ozone_draw_text(ozone,
ozone_draw_text(
ozone->footer_labels.search.str,
search_x + icon_size + icon_padding,
footer_text_y,
@ -2296,7 +2296,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
/* > fullscreen_thumbs */
if (fullscreen_thumbnails_available)
ozone_draw_text(ozone,
ozone_draw_text(
ozone->footer_labels.fullscreen_thumbs.str,
fullscreen_thumbs_x + icon_size + icon_padding,
footer_text_y,
@ -2304,7 +2304,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
/* > metadata_toggle */
if (metadata_override_available)
ozone_draw_text(ozone,
ozone_draw_text(
ozone->footer_labels.metadata_toggle.str,
metadata_toggle_x + icon_size + icon_padding,
footer_text_y,
@ -2376,7 +2376,7 @@ static void ozone_draw_footer(ozone_handle_t *ozone,
}
/* Draw text */
ozone_draw_text(ozone, core_title_buf,
ozone_draw_text(core_title_buf,
ticker_x_offset + footer_margin,
footer_text_y,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.footer, ozone->theme->text_rgba, false);

View File

@ -251,7 +251,6 @@ void ozone_restart_cursor_animation(ozone_handle_t *ozone)
}
void ozone_draw_text(
ozone_handle_t *ozone,
const char *str, float x,
float y,
enum text_alignment text_align,
@ -470,7 +469,7 @@ void ozone_draw_osk(ozone_handle_t *ozone,
{
const char *msg = list.elems[i].data;
ozone_draw_text(ozone, msg,
ozone_draw_text(msg,
margin + padding * 2,
margin + padding + ozone->fonts.entries_label.line_height + y_offset,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.entries_label, text_color, false);
@ -633,7 +632,7 @@ void ozone_draw_messagebox(
const char *msg = list.elems[i].data;
if (msg)
ozone_draw_text(ozone,
ozone_draw_text(
msg,
x - longest_width/2.0,
y + (i * ozone->fonts.footer.line_height) + ozone->fonts.footer.line_ascender,

View File

@ -22,7 +22,6 @@
#include "../../menu_driver.h"
void ozone_draw_text(
ozone_handle_t *ozone,
const char *str, float x,
float y,
enum text_alignment text_align,

View File

@ -104,7 +104,7 @@ static void ozone_draw_entry_value(
if (string_is_equal(entry->value, "..."))
return;
if (string_starts_with_size(entry->value, "(", STRLEN_CONST("(")) &&
string_ends_with (entry->value, ")")
string_ends_with (entry->value, ")")
)
{
if (
@ -129,15 +129,11 @@ static void ozone_draw_entry_value(
}
if (do_draw_text)
{
ozone_draw_text(ozone, value, x, y, TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.entries_label, COLOR_TEXT_ALPHA(ozone->theme->text_selected_rgba, alpha_uint32), false);
}
ozone_draw_text(value, x, y, TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.entries_label, COLOR_TEXT_ALPHA(ozone->theme->text_selected_rgba, alpha_uint32), false);
else
{
ozone_draw_text(ozone, (switch_is_on ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)),
x, y, TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.entries_label,
COLOR_TEXT_ALPHA((switch_is_on ? ozone->theme->text_selected_rgba : ozone->theme->text_sublabel_rgba), alpha_uint32), false);
}
ozone_draw_text((switch_is_on ? msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON) : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)),
x, y, TEXT_ALIGN_RIGHT, video_width, video_height, &ozone->fonts.entries_label,
COLOR_TEXT_ALPHA((switch_is_on ? ozone->theme->text_selected_rgba : ozone->theme->text_sublabel_rgba), alpha_uint32), false);
}
static void ozone_thumbnail_bar_hide_end(void *userdata)
@ -173,7 +169,6 @@ static void ozone_draw_no_thumbnail_available(ozone_handle_t *ozone,
gfx_display_blend_end(userdata);
ozone_draw_text(
ozone,
msg_hash_to_str(MSG_NO_THUMBNAIL_AVAILABLE),
x_position + sidebar_width/2,
video_height/2 + icon_size/2 + ozone->fonts.footer.line_ascender - y_offset,
@ -195,7 +190,7 @@ static void ozone_content_metadata_line(
uint32_t color,
unsigned lines_count)
{
ozone_draw_text(ozone,
ozone_draw_text(
text,
column_x,
*y + ozone->fonts.footer.line_ascender,
@ -775,7 +770,7 @@ border_iterate:
}
/* Draw text */
ozone_draw_text(ozone, rich_label,
ozone_draw_text(rich_label,
ticker_x_offset + text_offset + (unsigned)
ozone->dimensions_sidebar_width + x_offset +
entry_padding + ozone->dimensions.entry_icon_size +
@ -786,7 +781,7 @@ border_iterate:
if (menu_show_sublabels)
{
if (!string_is_empty(sublabel_str))
ozone_draw_text(ozone, sublabel_str,
ozone_draw_text(sublabel_str,
(unsigned) ozone->dimensions_sidebar_width +
x_offset + entry_padding +
ozone->dimensions.entry_icon_padding,

View File

@ -338,7 +338,7 @@ void ozone_draw_sidebar(
/* Text */
if (!ozone->sidebar_collapsed)
ozone_draw_text(ozone, title,
ozone_draw_text(title,
ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding * 2 + ozone->dimensions.sidebar_entry_icon_size,
y + ozone->dimensions.sidebar_entry_height / 2.0f + ozone->fonts.sidebar.line_centre_offset + ozone->animations.scroll_y_sidebar,
TEXT_ALIGN_LEFT, video_width, video_height, &ozone->fonts.sidebar, text_color, true);
@ -422,7 +422,7 @@ void ozone_draw_sidebar(
gfx_animation_ticker(&ticker);
}
ozone_draw_text(ozone, console_title,
ozone_draw_text(console_title,
ticker_x_offset + ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.sidebar_entry_icon_padding * 2 + ozone->dimensions.sidebar_entry_icon_size,
y + ozone->dimensions.sidebar_entry_height / 2 + ozone->fonts.sidebar.line_centre_offset + ozone->animations.scroll_y_sidebar,
TEXT_ALIGN_LEFT,