(XMB) Draw the setting icon like a regular node, so all categories icons can be animated in an uniform way

This commit is contained in:
Jean-André Santoni 2014-11-13 21:32:45 +01:00
parent 29bf7e962b
commit faae673beb

View File

@ -78,6 +78,7 @@ struct xmb_texture_item
typedef struct xmb_handle typedef struct xmb_handle
{ {
int active_category;
int num_categories; int num_categories;
int depth; int depth;
int old_depth; int old_depth;
@ -113,6 +114,7 @@ typedef struct xmb_handle
float i_passive_alpha; float i_passive_alpha;
void *font; void *font;
int font_size; int font_size;
xmb_node_t settings_node;
} xmb_handle_t; } xmb_handle_t;
static const GLfloat rmb_vertex[] = { static const GLfloat rmb_vertex[] = {
@ -560,17 +562,16 @@ static void xmb_populate_entries(void *data, const char *path,
else if (xmb->depth < xmb->old_depth) else if (xmb->depth < xmb->old_depth)
dir = -1; dir = -1;
for (j = 1; j < xmb->num_categories; j++) for (j = 0; j < xmb->num_categories; j++)
{ {
xmb_node_t *node = xmb_node_for_core(j-1); xmb_node_t *node = j ? xmb_node_for_core(j-1) : &xmb->settings_node;
if (!node) if (!node)
continue; continue;
if (xmb->depth <= 1) float ia = j == xmb->active_category ? xmb->c_active_alpha
add_tween(XMB_DELAY, xmb->c_passive_alpha, &node->alpha, &inOutQuad, NULL); : xmb->depth <= 1 ? xmb->c_passive_alpha : 0;
else add_tween(XMB_DELAY, ia, &node->alpha, &inOutQuad, NULL);
add_tween(XMB_DELAY, 0, &node->alpha, &inOutQuad, NULL);
} }
xmb_list_open_old(driver.menu->menu_list->selection_buf_old, dir, driver.menu->selection_ptr_old); xmb_list_open_old(driver.menu->menu_list->selection_buf_old, dir, driver.menu->selection_ptr_old);
@ -755,16 +756,9 @@ static void xmb_frame(void)
driver.menu->menu_list->menu_stack, driver.menu->menu_list->menu_stack,
driver.menu->selection_ptr); driver.menu->selection_ptr);
xmb_draw_icon(xmb->textures[XMB_TEXTURE_SETTINGS].id, for (i = 0; i < xmb->num_categories; i++)
xmb->x + xmb->margin_left + xmb->hspacing - xmb->icon_size / 2.0,
xmb->margin_top + xmb->icon_size / 2.0,
1.0,
0,
1.0);
for (i = 1; i < xmb->num_categories; i++)
{ {
xmb_node_t *node = xmb_node_for_core(i-1); xmb_node_t *node = i ? xmb_node_for_core(i-1) : &xmb->settings_node;
if (!node) if (!node)
continue; continue;
@ -853,6 +847,7 @@ static void *xmb_init(void)
xmb = (xmb_handle_t*)menu->userdata; xmb = (xmb_handle_t*)menu->userdata;
xmb->active_category = 0;
xmb->x = 0; xmb->x = 0;
xmb->alpha = 1.0f; xmb->alpha = 1.0f;
xmb->arrow_alpha = 0; xmb->arrow_alpha = 0;
@ -1069,6 +1064,10 @@ static void xmb_context_reset(void *data)
for (k = 0; k < XMB_TEXTURE_LAST; k++) for (k = 0; k < XMB_TEXTURE_LAST; k++)
xmb->textures[k].id = xmb_png_texture_load(xmb->textures[k].path); xmb->textures[k].id = xmb_png_texture_load(xmb->textures[k].path);
xmb->settings_node.icon = xmb->textures[XMB_TEXTURE_SETTINGS].id;
xmb->settings_node.alpha = xmb->c_active_alpha;
xmb->settings_node.zoom = xmb->c_active_zoom;
for (i = 1; i < xmb->num_categories; i++) for (i = 1; i < xmb->num_categories; i++)
{ {
char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX]; char core_id[PATH_MAX], texturepath[PATH_MAX], content_texturepath[PATH_MAX];
@ -1120,8 +1119,8 @@ static void xmb_context_reset(void *data)
strlcat(content_texturepath, "-content.png", sizeof(content_texturepath)); strlcat(content_texturepath, "-content.png", sizeof(content_texturepath));
node->icon = xmb_png_texture_load(texturepath); node->icon = xmb_png_texture_load(texturepath);
node->alpha = i ? xmb->c_passive_alpha : xmb->c_passive_alpha; node->alpha = xmb->c_passive_alpha;
node->zoom = i ? xmb->c_passive_zoom : xmb->c_passive_zoom; node->zoom = xmb->c_passive_zoom;
} }
} }