Organize variables in struct some more
This commit is contained in:
parent
41f1ffe0bb
commit
073e683846
|
@ -93,9 +93,35 @@ typedef struct xmb_handle
|
||||||
float alpha;
|
float alpha;
|
||||||
float hspacing;
|
float hspacing;
|
||||||
float vspacing;
|
float vspacing;
|
||||||
float margin_left;
|
|
||||||
float margin_top;
|
struct
|
||||||
float setting_margin_left;
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float left;
|
||||||
|
float top;
|
||||||
|
} screen;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float left;
|
||||||
|
} setting;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float left;
|
||||||
|
float top;
|
||||||
|
float bottom;
|
||||||
|
} title;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
float left;
|
||||||
|
float top;
|
||||||
|
} label;
|
||||||
|
} margins;
|
||||||
|
|
||||||
|
char title_name[PATH_MAX_LENGTH];
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -124,25 +150,6 @@ typedef struct xmb_handle
|
||||||
int size;
|
int size;
|
||||||
} icon;
|
} icon;
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
char name[PATH_MAX_LENGTH];
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
float left;
|
|
||||||
float top;
|
|
||||||
float bottom;
|
|
||||||
} margin;
|
|
||||||
} title;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
float left;
|
|
||||||
float top;
|
|
||||||
} margin;
|
|
||||||
} label;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
@ -700,7 +707,7 @@ static void xmb_set_title(menu_handle_t *menu, xmb_handle_t *xmb)
|
||||||
unsigned menu_type = 0;
|
unsigned menu_type = 0;
|
||||||
|
|
||||||
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
|
menu_list_get_last_stack(menu->menu_list, &dir, &label, &menu_type);
|
||||||
get_title(label, dir, menu_type, xmb->title.name, sizeof(xmb->title));
|
get_title(label, dir, menu_type, xmb->title_name, sizeof(xmb->title_name));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -713,7 +720,7 @@ static void xmb_set_title(menu_handle_t *menu, xmb_handle_t *xmb)
|
||||||
info = (core_info_t*)&info_list->list[menu->categories.selection_ptr - 1];
|
info = (core_info_t*)&info_list->list[menu->categories.selection_ptr - 1];
|
||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
strlcpy(xmb->title.name, info->display_name, sizeof(xmb->title));
|
strlcpy(xmb->title_name, info->display_name, sizeof(xmb->title_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,8 +877,8 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||||
if (!node)
|
if (!node)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
icon_x = node->x + xmb->margin_left + xmb->hspacing - xmb->icon.size / 2.0;
|
icon_x = node->x + xmb->margins.screen.left + xmb->hspacing - xmb->icon.size / 2.0;
|
||||||
icon_y = xmb->margin_top + node->y + xmb->icon.size / 2.0;
|
icon_y = xmb->margins.screen.top + node->y + xmb->icon.size / 2.0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
icon_x < -xmb->icon.size / 2 ||
|
icon_x < -xmb->icon.size / 2 ||
|
||||||
|
@ -956,8 +963,8 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||||
(i == current));
|
(i == current));
|
||||||
|
|
||||||
xmb_draw_text(gl, xmb, name,
|
xmb_draw_text(gl, xmb, name,
|
||||||
node->x + xmb->margin_left + xmb->hspacing + xmb->label.margin.left,
|
node->x + xmb->margins.screen.left + xmb->hspacing + xmb->margins.label.left,
|
||||||
xmb->margin_top + node->y + xmb->label.margin.top,
|
xmb->margins.screen.top + node->y + xmb->margins.label.top,
|
||||||
1, node->label_alpha, 0);
|
1, node->label_alpha, 0);
|
||||||
|
|
||||||
menu_animation_ticker_line(value, 35, g_extern.frame_count / 20, type_str,
|
menu_animation_ticker_line(value, 35, g_extern.frame_count / 20, type_str,
|
||||||
|
@ -977,27 +984,27 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
|
||||||
|| (!strcmp(type_str, "OFF")
|
|| (!strcmp(type_str, "OFF")
|
||||||
&& !xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)))
|
&& !xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)))
|
||||||
xmb_draw_text(gl, xmb, value,
|
xmb_draw_text(gl, xmb, value,
|
||||||
node->x + xmb->margin_left + xmb->hspacing +
|
node->x + xmb->margins.screen.left + xmb->hspacing +
|
||||||
xmb->label.margin.left + xmb->setting_margin_left,
|
xmb->margins.label.left + xmb->margins.setting.left,
|
||||||
xmb->margin_top + node->y + xmb->label.margin.top,
|
xmb->margins.screen.top + node->y + xmb->margins.label.top,
|
||||||
1,
|
1,
|
||||||
node->label_alpha,
|
node->label_alpha,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (!strcmp(type_str, "ON") && xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id)
|
if (!strcmp(type_str, "ON") && xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id)
|
||||||
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id,
|
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_SWITCH_ON].id,
|
||||||
node->x + xmb->margin_left + xmb->hspacing
|
node->x + xmb->margins.screen.left + xmb->hspacing
|
||||||
+ xmb->icon.size / 2.0 + xmb->setting_margin_left,
|
+ xmb->icon.size / 2.0 + xmb->margins.setting.left,
|
||||||
xmb->margin_top + node->y + xmb->icon.size / 2.0,
|
xmb->margins.screen.top + node->y + xmb->icon.size / 2.0,
|
||||||
node->alpha,
|
node->alpha,
|
||||||
0,
|
0,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
if (!strcmp(type_str, "OFF") && xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)
|
if (!strcmp(type_str, "OFF") && xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id)
|
||||||
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id,
|
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_SWITCH_OFF].id,
|
||||||
node->x + xmb->margin_left + xmb->hspacing
|
node->x + xmb->margins.screen.left + xmb->hspacing
|
||||||
+ xmb->icon.size / 2.0 + xmb->setting_margin_left,
|
+ xmb->icon.size / 2.0 + xmb->margins.setting.left,
|
||||||
xmb->margin_top + node->y + xmb->icon.size / 2.0,
|
xmb->margins.screen.top + node->y + xmb->icon.size / 2.0,
|
||||||
node->alpha,
|
node->alpha,
|
||||||
0,
|
0,
|
||||||
1);
|
1);
|
||||||
|
@ -1024,15 +1031,15 @@ static void xmb_frame(menu_handle_t *menu)
|
||||||
xmb_render_background(gl, xmb, false);
|
xmb_render_background(gl, xmb, false);
|
||||||
|
|
||||||
xmb_draw_text(gl, xmb,
|
xmb_draw_text(gl, xmb,
|
||||||
xmb->title.name, xmb->title.margin.left, xmb->title.margin.top, 1, 1, 0);
|
xmb->title_name, xmb->margins.title.left, xmb->margins.title.top, 1, 1, 0);
|
||||||
|
|
||||||
if (g_settings.menu.timedate_enable)
|
if (g_settings.menu.timedate_enable)
|
||||||
{
|
{
|
||||||
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
disp_timedate_set_label(timedate, sizeof(timedate), 0);
|
||||||
|
|
||||||
xmb_draw_text(gl, xmb,
|
xmb_draw_text(gl, xmb,
|
||||||
timedate, gl->win_width - xmb->title.margin.left - xmb->icon.size / 4,
|
timedate, gl->win_width - xmb->margins.title.left - xmb->icon.size / 4,
|
||||||
xmb->title.margin.top, 1, 1, 1);
|
xmb->margins.title.top, 1, 1, 1);
|
||||||
|
|
||||||
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
|
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_CLOCK].id,
|
||||||
gl->win_width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
|
gl->win_width - xmb->icon.size, xmb->icon.size, 1, 0, 1);
|
||||||
|
@ -1056,13 +1063,13 @@ static void xmb_frame(menu_handle_t *menu)
|
||||||
|
|
||||||
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
snprintf(title_msg, sizeof(title_msg), "%s - %s %s", PACKAGE_VERSION,
|
||||||
core_name, core_version);
|
core_name, core_version);
|
||||||
xmb_draw_text(gl, xmb, title_msg, xmb->title.margin.left,
|
xmb_draw_text(gl, xmb, title_msg, xmb->margins.title.left,
|
||||||
gl->win_height - xmb->title.margin.bottom, 1, 1, 0);
|
gl->win_height - xmb->margins.title.bottom, 1, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_ARROW].id,
|
xmb_draw_icon(gl, xmb, xmb->textures.list[XMB_TEXTURE_ARROW].id,
|
||||||
xmb->x + xmb->margin_left + xmb->hspacing - xmb->icon.size / 2.0 + xmb->icon.size,
|
xmb->x + xmb->margins.screen.left + xmb->hspacing - xmb->icon.size / 2.0 + xmb->icon.size,
|
||||||
xmb->margin_top + xmb->icon.size / 2.0 + xmb->vspacing * xmb->item.active.factor,
|
xmb->margins.screen.top + xmb->icon.size / 2.0 + xmb->vspacing * xmb->item.active.factor,
|
||||||
xmb->textures.arrow.alpha, 0, 1);
|
xmb->textures.arrow.alpha, 0, 1);
|
||||||
|
|
||||||
depth = file_list_get_size(menu->menu_list->menu_stack);
|
depth = file_list_get_size(menu->menu_list->menu_stack);
|
||||||
|
@ -1086,8 +1093,8 @@ static void xmb_frame(menu_handle_t *menu)
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
xmb_draw_icon(gl, xmb, node->icon,
|
xmb_draw_icon(gl, xmb, node->icon,
|
||||||
xmb->x + xmb->categories.x_pos + xmb->margin_left + xmb->hspacing * (i + 1) - xmb->icon.size / 2.0,
|
xmb->x + xmb->categories.x_pos + xmb->margins.screen.left + xmb->hspacing * (i + 1) - xmb->icon.size / 2.0,
|
||||||
xmb->margin_top + xmb->icon.size / 2.0,
|
xmb->margins.screen.top + xmb->icon.size / 2.0,
|
||||||
node->alpha,
|
node->alpha,
|
||||||
0,
|
0,
|
||||||
node->zoom);
|
node->zoom);
|
||||||
|
@ -1210,14 +1217,14 @@ static void *xmb_init(void)
|
||||||
xmb->font.size = 32.0 * scale_factor;
|
xmb->font.size = 32.0 * scale_factor;
|
||||||
xmb->hspacing = 200.0 * scale_factor;
|
xmb->hspacing = 200.0 * scale_factor;
|
||||||
xmb->vspacing = 64.0 * scale_factor;
|
xmb->vspacing = 64.0 * scale_factor;
|
||||||
xmb->margin_left = 336.0 * scale_factor;
|
xmb->margins.screen.left = 336.0 * scale_factor;
|
||||||
xmb->margin_top = (256+32) * scale_factor;
|
xmb->margins.screen.top = (256+32) * scale_factor;
|
||||||
xmb->title.margin.left = 60 * scale_factor;
|
xmb->margins.title.left = 60 * scale_factor;
|
||||||
xmb->title.margin.top = 60 * scale_factor + xmb->font.size/3;
|
xmb->margins.title.top = 60 * scale_factor + xmb->font.size/3;
|
||||||
xmb->title.margin.bottom = 60 * scale_factor - xmb->font.size/3;
|
xmb->margins.title.bottom = 60 * scale_factor - xmb->font.size/3;
|
||||||
xmb->label.margin.left = 85.0 * scale_factor;
|
xmb->margins.label.left = 85.0 * scale_factor;
|
||||||
xmb->label.margin.top = xmb->font.size/3.0;
|
xmb->margins.label.top = xmb->font.size/3.0;
|
||||||
xmb->setting_margin_left = 600.0 * scale_factor;
|
xmb->margins.setting.left = 600.0 * scale_factor;
|
||||||
|
|
||||||
menu->categories.size = 1;
|
menu->categories.size = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue