mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
Add MENU_ANIMATION_CTL_KILL_BY_SUBJECT
This commit is contained in:
parent
e424d432a2
commit
5dbca80ed8
@ -2477,7 +2477,8 @@ static void xmb_list_clear(file_list_t *list)
|
|||||||
|
|
||||||
for (i = 0; i < size; ++i)
|
for (i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
float *subjects[5];
|
menu_animation_ctx_subject_t subject;
|
||||||
|
float *subjects[5] = {NULL};
|
||||||
xmb_node_t *node = (xmb_node_t*)
|
xmb_node_t *node = (xmb_node_t*)
|
||||||
menu_entries_get_userdata_at_offset(list, i);
|
menu_entries_get_userdata_at_offset(list, i);
|
||||||
|
|
||||||
@ -2490,7 +2491,10 @@ static void xmb_list_clear(file_list_t *list)
|
|||||||
subjects[3] = &node->x;
|
subjects[3] = &node->x;
|
||||||
subjects[4] = &node->y;
|
subjects[4] = &node->y;
|
||||||
|
|
||||||
menu_animation_kill_by_subject(5, subjects);
|
subject.count = 5;
|
||||||
|
subject.data = subjects;
|
||||||
|
|
||||||
|
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject);
|
||||||
|
|
||||||
file_list_free_userdata(list, i);
|
file_list_free_userdata(list, i);
|
||||||
}
|
}
|
||||||
@ -2508,15 +2512,19 @@ static void xmb_list_deep_copy(const file_list_t *src, file_list_t *dst)
|
|||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
float *subjects[5];
|
menu_animation_ctx_subject_t subject;
|
||||||
|
float *subjects[5] = {NULL};
|
||||||
|
|
||||||
subjects[0] = &node->alpha;
|
subjects[0] = &node->alpha;
|
||||||
subjects[1] = &node->label_alpha;
|
subjects[1] = &node->label_alpha;
|
||||||
subjects[2] = &node->zoom;
|
subjects[2] = &node->zoom;
|
||||||
subjects[3] = &node->x;
|
subjects[3] = &node->x;
|
||||||
subjects[4] = &node->y;
|
subjects[4] = &node->y;
|
||||||
|
|
||||||
menu_animation_kill_by_subject(5, subjects);
|
subject.count = 5;
|
||||||
|
subject.data = subjects;
|
||||||
|
|
||||||
|
menu_animation_ctl(MENU_ANIMATION_CTL_KILL_BY_SUBJECT, &subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_list_free_userdata(dst, i);
|
file_list_free_userdata(dst, i);
|
||||||
|
@ -381,34 +381,6 @@ static void menu_animation_push_internal(menu_animation_t *anim,
|
|||||||
*target = *t;
|
*target = *t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_animation_kill_by_subject(size_t count, const void *subjects)
|
|
||||||
{
|
|
||||||
unsigned i, j, killed = 0;
|
|
||||||
float **sub = (float**)subjects;
|
|
||||||
menu_animation_t *anim = menu_animation_get_ptr();
|
|
||||||
|
|
||||||
for (i = 0; i < anim->size; ++i)
|
|
||||||
{
|
|
||||||
if (!anim->list[i].alive)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (j = 0; j < count; ++j)
|
|
||||||
{
|
|
||||||
if (anim->list[i].subject != sub[j])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
anim->list[i].alive = false;
|
|
||||||
anim->list[i].subject = NULL;
|
|
||||||
|
|
||||||
if (i < anim->first_dead)
|
|
||||||
anim->first_dead = i;
|
|
||||||
|
|
||||||
killed++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menu_animation_push(float duration, float target_value, float* subject,
|
bool menu_animation_push(float duration, float target_value, float* subject,
|
||||||
enum menu_animation_easing_type easing_enum, int tag, tween_cb cb)
|
enum menu_animation_easing_type easing_enum, int tag, tween_cb cb)
|
||||||
{
|
{
|
||||||
@ -698,8 +670,37 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
case MENU_ANIMATION_CTL_KILL_BY_SUBJECT:
|
||||||
|
{
|
||||||
|
unsigned i, j, killed = 0;
|
||||||
|
menu_animation_ctx_subject_t *subject =
|
||||||
|
(menu_animation_ctx_subject_t*)data;
|
||||||
|
float **sub = (float**)subject->data;
|
||||||
|
|
||||||
|
for (i = 0; i < anim->size; ++i)
|
||||||
|
{
|
||||||
|
if (!anim->list[i].alive)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (j = 0; j < subject->count; ++j)
|
||||||
|
{
|
||||||
|
if (anim->list[i].subject != sub[j])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
anim->list[i].alive = false;
|
||||||
|
anim->list[i].subject = NULL;
|
||||||
|
|
||||||
|
if (i < anim->first_dead)
|
||||||
|
anim->first_dead = i;
|
||||||
|
|
||||||
|
killed++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case MENU_ANIMATION_CTL_NONE:
|
case MENU_ANIMATION_CTL_NONE:
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,8 @@ enum menu_animation_ctl_state
|
|||||||
MENU_ANIMATION_CTL_DELTA_TIME,
|
MENU_ANIMATION_CTL_DELTA_TIME,
|
||||||
MENU_ANIMATION_CTL_UPDATE_TIME,
|
MENU_ANIMATION_CTL_UPDATE_TIME,
|
||||||
MENU_ANIMATION_CTL_UPDATE,
|
MENU_ANIMATION_CTL_UPDATE,
|
||||||
MENU_ANIMATION_CTL_KILL_BY_TAG
|
MENU_ANIMATION_CTL_KILL_BY_TAG,
|
||||||
|
MENU_ANIMATION_CTL_KILL_BY_SUBJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_animation_easing_type
|
enum menu_animation_easing_type
|
||||||
@ -96,7 +97,11 @@ typedef struct menu_animation_ctx_tag
|
|||||||
int id;
|
int id;
|
||||||
} menu_animation_ctx_tag_t;
|
} menu_animation_ctx_tag_t;
|
||||||
|
|
||||||
void menu_animation_kill_by_subject(size_t count, const void *subjects);
|
typedef struct menu_animation_ctx_subject
|
||||||
|
{
|
||||||
|
size_t count;
|
||||||
|
const void *data;
|
||||||
|
} menu_animation_ctx_subject_t;
|
||||||
|
|
||||||
/* Use -1 for untagged */
|
/* Use -1 for untagged */
|
||||||
bool menu_animation_push(float duration, float target_value, float* subject,
|
bool menu_animation_push(float duration, float target_value, float* subject,
|
||||||
|
Loading…
Reference in New Issue
Block a user