Refactor menu_animation_set_active

This commit is contained in:
twinaphex 2015-09-25 23:42:00 +02:00
parent 88307565c1
commit 9ee3954423
6 changed files with 9 additions and 15 deletions

View File

@ -457,7 +457,7 @@ static void general_disp_set_label_perf_counters(
menu_action_setting_disp_set_label_perf_counters_common(
counters, offset, s, len);
menu_animation_set_active();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
}
static void menu_action_setting_disp_set_label_perf_counters(

View File

@ -452,7 +452,7 @@ static void glui_frame(void)
width, height,
&highlight_bg[0]);
menu_animation_set_active();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
glui_render_quad(gl, 0, 0, width,
header_height,

View File

@ -670,14 +670,6 @@ void menu_animation_update_time(void)
}
}
void menu_animation_set_active(void)
{
menu_animation_t *anim = menu_animation_get_ptr();
if (!anim)
return;
anim->is_active = true;
}
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
{
menu_animation_t *anim = menu_animation_get_ptr();
@ -692,6 +684,9 @@ bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data)
case MENU_ANIMATION_CTL_CLEAR_ACTIVE:
anim->is_active = false;
return true;
case MENU_ANIMATION_CTL_SET_ACTIVE:
anim->is_active = true;
return true;
case MENU_ANIMATION_CTL_DELTA_TIME:
{
float *ptr = (float*)data;

View File

@ -38,6 +38,7 @@ enum menu_animation_ctl_state
{
MENU_ANIMATION_CTL_IS_ACTIVE = 0,
MENU_ANIMATION_CTL_CLEAR_ACTIVE,
MENU_ANIMATION_CTL_SET_ACTIVE,
MENU_ANIMATION_CTL_DELTA_TIME
};
@ -115,8 +116,6 @@ void menu_animation_ticker_str(char *s, size_t len, uint64_t tick,
void menu_animation_update_time(void);
void menu_animation_set_active(void);
bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data);
#ifdef __cplusplus

View File

@ -838,7 +838,7 @@ static int menu_input_mouse(unsigned *action)
menu_input->mouse.scrollup ||
menu_input->mouse.scrolldown
)
menu_animation_set_active();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
return 0;
}
@ -885,7 +885,7 @@ static int menu_input_pointer(unsigned *action)
(menu_input->pointer.dy != 0) ||
(menu_input->pointer.dx != 0)
)
menu_animation_set_active();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
return 0;
}

View File

@ -1185,7 +1185,7 @@ static void setting_get_string_representation_st_float_video_refresh_rate_auto(v
{
snprintf(s, len, "%.3f Hz (%.1f%% dev, %u samples)",
video_refresh_rate, 100.0 * deviation, sample_points);
menu_animation_set_active();
menu_animation_ctl(MENU_ANIMATION_CTL_SET_ACTIVE, NULL);
}
else
strlcpy(s, menu_hash_to_str(MENU_VALUE_NOT_AVAILABLE), len);