mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 08:59:58 +00:00
Merge pull request #8074 from natinusala/master
menu_animation: add delayed animations
This commit is contained in:
commit
39d50591af
@ -333,6 +333,29 @@ void menu_animation_free(void)
|
||||
da_free(anim.pending);
|
||||
}
|
||||
|
||||
static void menu_delayed_animation_cb(void *userdata)
|
||||
{
|
||||
menu_delayed_animation_t *delayed_animation = (menu_delayed_animation_t*) userdata;
|
||||
|
||||
menu_animation_push(&delayed_animation->entry);
|
||||
|
||||
free(delayed_animation);
|
||||
}
|
||||
|
||||
void menu_animation_push_delayed(unsigned delay, menu_animation_ctx_entry_t *entry)
|
||||
{
|
||||
menu_timer_ctx_entry_t timer_entry;
|
||||
menu_delayed_animation_t *delayed_animation = (menu_delayed_animation_t*) malloc(sizeof(menu_delayed_animation_t));
|
||||
|
||||
memcpy(&delayed_animation->entry, entry, sizeof(menu_animation_ctx_entry_t));
|
||||
|
||||
timer_entry.cb = menu_delayed_animation_cb;
|
||||
timer_entry.duration = delay;
|
||||
timer_entry.userdata = delayed_animation;
|
||||
|
||||
menu_timer_start(&delayed_animation->timer, &timer_entry);
|
||||
}
|
||||
|
||||
bool menu_animation_push(menu_animation_ctx_entry_t *entry)
|
||||
{
|
||||
struct tween t;
|
||||
|
@ -127,6 +127,12 @@ typedef struct menu_timer_ctx_entry
|
||||
void *userdata;
|
||||
} menu_timer_ctx_entry_t;
|
||||
|
||||
typedef struct menu_delayed_animation
|
||||
{
|
||||
menu_timer_t timer;
|
||||
menu_animation_ctx_entry_t entry;
|
||||
} menu_delayed_animation_t;
|
||||
|
||||
void menu_timer_start(menu_timer_t *timer, menu_timer_ctx_entry_t *timer_entry);
|
||||
|
||||
void menu_timer_kill(menu_timer_t *timer);
|
||||
@ -151,6 +157,8 @@ void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject);
|
||||
|
||||
bool menu_animation_push(menu_animation_ctx_entry_t *entry);
|
||||
|
||||
void menu_animation_push_delayed(unsigned delay, menu_animation_ctx_entry_t *entry);
|
||||
|
||||
float menu_animation_get_delta_time(void);
|
||||
|
||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
||||
|
Loading…
Reference in New Issue
Block a user