Create menu_animation_get_ideal_delta_time

This commit is contained in:
twinaphex 2017-01-17 16:37:03 +01:00
parent bfb124a60e
commit df783daab9
5 changed files with 14 additions and 14 deletions

View File

@ -579,7 +579,7 @@ static void mui_render(void *data)
delta.current = delta_time;
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
if (menu_animation_get_ideal_delta_time(&delta))
menu_animation_update(delta.ideal);
menu_display_set_width(width);

View File

@ -2337,7 +2337,7 @@ static void xmb_render(void *data)
delta.current = delta_time;
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
if (menu_animation_get_ideal_delta_time(&delta))
menu_animation_update(delta.ideal);
if (settings->menu.pointer.enable || settings->menu.mouse.enable)

View File

@ -558,6 +558,14 @@ bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker)
return true;
}
bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta)
{
if (!delta)
return false;
delta->ideal = delta->current / IDEAL_DELTA_TIME;
return true;
}
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
{
switch (state)
@ -668,15 +676,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
}
}
break;
case MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET:
{
menu_animation_ctx_delta_t *delta =
(menu_animation_ctx_delta_t*)data;
if (!delta)
return false;
delta->ideal = delta->current / IDEAL_DELTA_TIME;
}
break;
case MENU_ANIMATION_CTL_PUSH:
return menu_animation_push(&anim, (menu_animation_ctx_entry_t *)data);
case MENU_ANIMATION_CTL_NONE:

View File

@ -39,8 +39,7 @@ enum menu_animation_ctl_state
MENU_ANIMATION_CTL_UPDATE_TIME,
MENU_ANIMATION_CTL_KILL_BY_TAG,
MENU_ANIMATION_CTL_KILL_BY_SUBJECT,
MENU_ANIMATION_CTL_PUSH,
MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET
MENU_ANIMATION_CTL_PUSH
};
enum menu_animation_easing_type
@ -127,6 +126,8 @@ typedef struct menu_animation_ctx_ticker
bool menu_animation_update(float delta_time);
bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta);
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);

View File

@ -182,7 +182,7 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
delta.current = delta_time;
if (menu_animation_ctl(MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET, &delta))
if (menu_animation_get_ideal_delta_time(&delta))
delay_count += delta.ideal;
if (menu_input_dialog_get_display_kb())