mirror of
https://github.com/libretro/RetroArch
synced 2025-03-05 19:13:45 +00:00
(menu_animation.c) Create more separate functions
This commit is contained in:
parent
df783daab9
commit
2273b1d05f
@ -566,6 +566,33 @@ bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta)
|
||||
return true;
|
||||
}
|
||||
|
||||
void menu_animation_update_time(void)
|
||||
{
|
||||
static retro_time_t last_clock_update = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
cur_time = cpu_features_get_time_usec();
|
||||
delta_time = cur_time - old_time;
|
||||
|
||||
if (delta_time >= IDEAL_DELTA_TIME* 4)
|
||||
delta_time = IDEAL_DELTA_TIME * 4;
|
||||
if (delta_time <= IDEAL_DELTA_TIME / 4)
|
||||
delta_time = IDEAL_DELTA_TIME / 4;
|
||||
old_time = cur_time;
|
||||
|
||||
if (((cur_time - last_clock_update) > 1000000)
|
||||
&& settings->menu.timedate_enable)
|
||||
{
|
||||
animation_is_active = true;
|
||||
last_clock_update = cur_time;
|
||||
}
|
||||
}
|
||||
|
||||
bool menu_animation_is_active(void)
|
||||
{
|
||||
return animation_is_active;
|
||||
}
|
||||
|
||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
{
|
||||
switch (state)
|
||||
@ -588,8 +615,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
old_time = 0;
|
||||
delta_time = 0.0f;
|
||||
break;
|
||||
case MENU_ANIMATION_CTL_IS_ACTIVE:
|
||||
return animation_is_active;
|
||||
case MENU_ANIMATION_CTL_CLEAR_ACTIVE:
|
||||
animation_is_active = false;
|
||||
break;
|
||||
@ -604,28 +629,6 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
|
||||
*ptr = delta_time;
|
||||
}
|
||||
break;
|
||||
case MENU_ANIMATION_CTL_UPDATE_TIME:
|
||||
{
|
||||
static retro_time_t last_clock_update = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
cur_time = cpu_features_get_time_usec();
|
||||
delta_time = cur_time - old_time;
|
||||
|
||||
if (delta_time >= IDEAL_DELTA_TIME* 4)
|
||||
delta_time = IDEAL_DELTA_TIME * 4;
|
||||
if (delta_time <= IDEAL_DELTA_TIME / 4)
|
||||
delta_time = IDEAL_DELTA_TIME / 4;
|
||||
old_time = cur_time;
|
||||
|
||||
if (((cur_time - last_clock_update) > 1000000)
|
||||
&& settings->menu.timedate_enable)
|
||||
{
|
||||
animation_is_active = true;
|
||||
last_clock_update = cur_time;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_ANIMATION_CTL_KILL_BY_TAG:
|
||||
{
|
||||
unsigned i;
|
||||
|
@ -31,12 +31,10 @@ typedef void (*tween_cb) (void);
|
||||
enum menu_animation_ctl_state
|
||||
{
|
||||
MENU_ANIMATION_CTL_NONE = 0,
|
||||
MENU_ANIMATION_CTL_IS_ACTIVE,
|
||||
MENU_ANIMATION_CTL_DEINIT,
|
||||
MENU_ANIMATION_CTL_CLEAR_ACTIVE,
|
||||
MENU_ANIMATION_CTL_SET_ACTIVE,
|
||||
MENU_ANIMATION_CTL_DELTA_TIME,
|
||||
MENU_ANIMATION_CTL_UPDATE_TIME,
|
||||
MENU_ANIMATION_CTL_KILL_BY_TAG,
|
||||
MENU_ANIMATION_CTL_KILL_BY_SUBJECT,
|
||||
MENU_ANIMATION_CTL_PUSH
|
||||
@ -130,6 +128,10 @@ bool menu_animation_get_ideal_delta_time(menu_animation_ctx_delta_t *delta);
|
||||
|
||||
bool menu_animation_ticker(const menu_animation_ctx_ticker_t *ticker);
|
||||
|
||||
void menu_animation_update_time(void);
|
||||
|
||||
bool menu_animation_is_active(void);
|
||||
|
||||
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
@ -390,7 +390,7 @@ void menu_display_set_font_data_init(bool state)
|
||||
|
||||
bool menu_display_get_update_pending(void)
|
||||
{
|
||||
if (menu_animation_ctl(MENU_ANIMATION_CTL_IS_ACTIVE, NULL))
|
||||
if (menu_animation_is_active())
|
||||
return true;
|
||||
if (menu_display_get_framebuffer_dirty_flag())
|
||||
return true;
|
||||
|
@ -471,7 +471,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
|
||||
if (BIT64_GET(menu_driver_data->state, MENU_STATE_BLIT))
|
||||
{
|
||||
menu_animation_ctl(MENU_ANIMATION_CTL_UPDATE_TIME, NULL);
|
||||
menu_animation_update_time();
|
||||
menu_driver_ctl(RARCH_MENU_CTL_BLIT_RENDER, NULL);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user