mirror of
https://github.com/libretro/RetroArch
synced 2025-04-25 09:02:44 +00:00
Create optimized function - menu_animation_get_time
This commit is contained in:
parent
8292a41ccd
commit
ab182cbe20
@ -591,14 +591,6 @@ bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker)
|
|||||||
return true;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void menu_animation_update_time(bool timedate_enable)
|
void menu_animation_update_time(bool timedate_enable)
|
||||||
{
|
{
|
||||||
static retro_time_t
|
static retro_time_t
|
||||||
@ -686,9 +678,10 @@ void menu_animation_kill_by_subject(menu_animation_ctx_subject_t *subject)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float menu_animation_get_delta_time(void)
|
void menu_animation_get_time(menu_animation_ctx_delta_t *delta)
|
||||||
{
|
{
|
||||||
return delta_time;
|
delta->current = delta_time;
|
||||||
|
delta->ideal = delta_time / IDEAL_DELTA_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||||
|
@ -143,7 +143,7 @@ void menu_animation_free(void);
|
|||||||
|
|
||||||
bool menu_animation_update(float delta_time);
|
bool menu_animation_update(float delta_time);
|
||||||
|
|
||||||
bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta);
|
void menu_animation_get_time(menu_animation_ctx_delta_t *delta);
|
||||||
|
|
||||||
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
|
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
|
||||||
|
|
||||||
@ -159,8 +159,6 @@ bool menu_animation_push(menu_animation_ctx_entry_t *entry);
|
|||||||
|
|
||||||
void menu_animation_push_delayed(unsigned delay, 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);
|
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
@ -235,10 +235,8 @@ unsigned menu_event(input_bits_t *p_input, input_bits_t *p_trigger_input)
|
|||||||
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
||||||
&new_scroll_accel);
|
&new_scroll_accel);
|
||||||
|
|
||||||
delta.current = menu_animation_get_delta_time();
|
menu_animation_get_time(&delta);
|
||||||
|
delay_count += delta.ideal;
|
||||||
if (menu_animation_get_ideal_delta_time(&delta))
|
|
||||||
delay_count += delta.ideal;
|
|
||||||
|
|
||||||
if (menu_input_dialog_get_display_kb())
|
if (menu_input_dialog_get_display_kb())
|
||||||
{
|
{
|
||||||
|
11
retroarch.c
11
retroarch.c
@ -2641,6 +2641,7 @@ static enum runloop_state runloop_check_state(
|
|||||||
bool rarch_is_initialized = rarch_ctl(RARCH_CTL_IS_INITED, NULL);
|
bool rarch_is_initialized = rarch_ctl(RARCH_CTL_IS_INITED, NULL);
|
||||||
bool fs_toggle_triggered = false;
|
bool fs_toggle_triggered = false;
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
|
menu_animation_ctx_delta_t delta;
|
||||||
bool menu_driver_binding_state = menu_driver_is_binding_state();
|
bool menu_driver_binding_state = menu_driver_is_binding_state();
|
||||||
bool menu_is_alive = menu_driver_is_alive();
|
bool menu_is_alive = menu_driver_is_alive();
|
||||||
unsigned menu_toggle_gamepad_combo = settings->uints.input_menu_toggle_gamepad_combo;
|
unsigned menu_toggle_gamepad_combo = settings->uints.input_menu_toggle_gamepad_combo;
|
||||||
@ -2828,14 +2829,8 @@ static enum runloop_state runloop_check_state(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_MENU)
|
#if defined(HAVE_MENU)
|
||||||
{
|
menu_animation_get_time(&delta);
|
||||||
menu_animation_ctx_delta_t delta;
|
menu_animation_update(delta.ideal);
|
||||||
|
|
||||||
delta.current = menu_animation_get_delta_time();
|
|
||||||
|
|
||||||
if (menu_animation_get_ideal_delta_time(&delta))
|
|
||||||
menu_animation_update(delta.ideal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menu_is_alive)
|
if (menu_is_alive)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user