mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Create MENU_ANIMATION_CTL_KILL_BY_TAG
This commit is contained in:
parent
433155c95f
commit
bd0347f1ae
@ -592,7 +592,8 @@ static void xmb_selection_pointer_changed(
|
||||
xmb_handle_t *xmb, bool allow_animations)
|
||||
{
|
||||
size_t skip;
|
||||
unsigned i, end, tag, height, depth;
|
||||
unsigned i, end, height, depth;
|
||||
menu_animation_ctx_tag_t tag;
|
||||
size_t selection, num = 0;
|
||||
int threshold = 0;
|
||||
menu_list_t *menu_list = NULL;
|
||||
@ -607,12 +608,13 @@ static void xmb_selection_pointer_changed(
|
||||
return;
|
||||
|
||||
end = menu_entries_get_end();
|
||||
tag = (uintptr_t)menu_list;
|
||||
threshold = xmb->icon.size*10;
|
||||
|
||||
video_driver_get_size(NULL, &height);
|
||||
|
||||
menu_animation_kill_by_tag(tag);
|
||||
tag.id = (uintptr_t)menu_list;
|
||||
|
||||
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_TAG, &tag);
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &num);
|
||||
skip = 0;
|
||||
|
||||
@ -657,13 +659,13 @@ static void xmb_selection_pointer_changed(
|
||||
else
|
||||
{
|
||||
menu_animation_push(XMB_DELAY, ia, &node->alpha,
|
||||
EASING_IN_OUT_QUAD, tag, NULL);
|
||||
EASING_IN_OUT_QUAD, tag.id, NULL);
|
||||
menu_animation_push(XMB_DELAY, ia, &node->label_alpha,
|
||||
EASING_IN_OUT_QUAD, tag, NULL);
|
||||
EASING_IN_OUT_QUAD, tag.id, NULL);
|
||||
menu_animation_push(XMB_DELAY, iz, &node->zoom,
|
||||
EASING_IN_OUT_QUAD, tag, NULL);
|
||||
EASING_IN_OUT_QUAD, tag.id, NULL);
|
||||
menu_animation_push(XMB_DELAY, iy, &node->y,
|
||||
EASING_IN_OUT_QUAD, tag, NULL);
|
||||
EASING_IN_OUT_QUAD, tag.id, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,9 @@ struct menu_animation
|
||||
retro_time_t old_time;
|
||||
};
|
||||
|
||||
typedef float (*easing_cb) (float, float, float, float);
|
||||
typedef void (*tween_cb) (void);
|
||||
|
||||
typedef struct menu_animation menu_animation_t;
|
||||
|
||||
static menu_animation_t *menu_animation_get_ptr(void)
|
||||
@ -425,28 +428,6 @@ void menu_animation_kill_by_subject(size_t count, const void *subjects)
|
||||
}
|
||||
}
|
||||
|
||||
void menu_animation_kill_by_tag(int tag)
|
||||
{
|
||||
unsigned i;
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
|
||||
if (tag == -1)
|
||||
return;
|
||||
|
||||
for (i = 0; i < anim->size; ++i)
|
||||
{
|
||||
if (anim->list[i].tag == tag)
|
||||
{
|
||||
anim->list[i].alive = false;
|
||||
anim->list[i].subject = NULL;
|
||||
|
||||
if (i < anim->first_dead)
|
||||
anim->first_dead = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool menu_animation_push(float duration, float target_value, float* subject,
|
||||
enum menu_animation_easing_type easing_enum, int tag, tween_cb cb)
|
||||
{
|
||||
@ -698,6 +679,27 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
anim->is_active = true;
|
||||
}
|
||||
break;
|
||||
case MENU_ANIMATION_CTL_KILL_BY_TAG:
|
||||
{
|
||||
unsigned i;
|
||||
menu_animation_ctx_tag_t *tag = (menu_animation_ctx_tag_t*)data;
|
||||
|
||||
if (!tag || tag->id == -1)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < anim->size; ++i)
|
||||
{
|
||||
if (anim->list[i].tag != tag->id)
|
||||
continue;
|
||||
|
||||
anim->list[i].alive = false;
|
||||
anim->list[i].subject = NULL;
|
||||
|
||||
if (i < anim->first_dead)
|
||||
anim->first_dead = i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case MENU_ANIMATION_CTL_NONE:
|
||||
break;
|
||||
|
@ -41,7 +41,8 @@ enum menu_animation_ctl_state
|
||||
MENU_ANIMATION_CTL_SET_ACTIVE,
|
||||
MENU_ANIMATION_CTL_DELTA_TIME,
|
||||
MENU_ANIMATION_CTL_UPDATE_TIME,
|
||||
MENU_ANIMATION_CTL_UPDATE
|
||||
MENU_ANIMATION_CTL_UPDATE,
|
||||
MENU_ANIMATION_CTL_KILL_BY_TAG
|
||||
};
|
||||
|
||||
enum menu_animation_easing_type
|
||||
@ -90,9 +91,12 @@ enum menu_animation_easing_type
|
||||
EASING_OUT_IN_BOUNCE
|
||||
};
|
||||
|
||||
void menu_animation_kill_by_subject(size_t count, const void *subjects);
|
||||
typedef struct menu_animation_ctx_tag
|
||||
{
|
||||
int id;
|
||||
} menu_animation_ctx_tag_t;
|
||||
|
||||
void menu_animation_kill_by_tag(int tag);
|
||||
void menu_animation_kill_by_subject(size_t count, const void *subjects);
|
||||
|
||||
/* Use -1 for untagged */
|
||||
bool menu_animation_push(float duration, float target_value, float* subject,
|
||||
|
Loading…
x
Reference in New Issue
Block a user