mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-12 20:58:18 +00:00
Cleanup menu_animation_t
This commit is contained in:
parent
33240511da
commit
3b3fa56309
@ -451,7 +451,7 @@ static void general_disp_set_label_perf_counters(
|
||||
const char *path, unsigned *w
|
||||
)
|
||||
{
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
|
||||
*s = '\0';
|
||||
*w = 19;
|
||||
|
@ -383,7 +383,7 @@ static void glui_frame(void)
|
||||
const struct font_renderer *font_driver = NULL;
|
||||
driver_t *driver = driver_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
@ -370,7 +370,7 @@ static void rgui_render(void)
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
rgui_t *rgui = NULL;
|
||||
|
||||
|
@ -130,7 +130,7 @@ static void rmenu_render(void)
|
||||
char title_msg[64] = {0};
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
uint64_t *frame_count = video_driver_get_frame_count();
|
||||
|
@ -536,7 +536,7 @@ static void rmenu_xui_render(void)
|
||||
const char *label = NULL;
|
||||
unsigned menu_type = 0;
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
|
@ -1481,7 +1481,7 @@ static void xmb_render(void)
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
menu_navigation_t *nav = menu_navigation_get_ptr();
|
||||
menu_list_t *menu_list = menu_list_get_ptr();
|
||||
|
@ -51,7 +51,7 @@ struct menu_animation
|
||||
retro_time_t old_time;
|
||||
};
|
||||
|
||||
struct menu_animation_t *menu_animation_get_ptr(void)
|
||||
menu_animation_t *menu_animation_get_ptr(void)
|
||||
{
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
if (!disp)
|
||||
@ -287,10 +287,9 @@ static float easing_out_in_bounce(float t, float b, float c, float d)
|
||||
return easing_in_bounce((t * 2) - d, b + c / 2, c / 2, d);
|
||||
}
|
||||
|
||||
void menu_animation_free(struct menu_animation_t *animation)
|
||||
void menu_animation_free(menu_animation_t *anim)
|
||||
{
|
||||
size_t i;
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
|
||||
if (!anim)
|
||||
return;
|
||||
@ -305,12 +304,11 @@ void menu_animation_free(struct menu_animation_t *animation)
|
||||
free(anim);
|
||||
}
|
||||
|
||||
void menu_animation_kill_by_subject(struct menu_animation_t *animation,
|
||||
void menu_animation_kill_by_subject(menu_animation_t *anim,
|
||||
size_t count, const void *subjects)
|
||||
{
|
||||
unsigned i, j, killed = 0;
|
||||
float **sub = (float**)subjects;
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
|
||||
for (i = 0; i < anim->size; ++i)
|
||||
{
|
||||
@ -334,10 +332,9 @@ void menu_animation_kill_by_subject(struct menu_animation_t *animation,
|
||||
}
|
||||
}
|
||||
|
||||
void menu_animation_kill_by_tag(struct menu_animation_t *animation, int tag)
|
||||
void menu_animation_kill_by_tag(menu_animation_t *anim, int tag)
|
||||
{
|
||||
unsigned i;
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
|
||||
if (tag == -1)
|
||||
return;
|
||||
@ -355,7 +352,7 @@ void menu_animation_kill_by_tag(struct menu_animation_t *animation, int tag)
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_animation_push_internal(struct menu_animation *anim, const struct tween *t)
|
||||
static void menu_animation_push_internal(menu_animation_t *anim, const struct tween *t)
|
||||
{
|
||||
struct tween *target = NULL;
|
||||
|
||||
@ -376,14 +373,13 @@ static void menu_animation_push_internal(struct menu_animation *anim, const stru
|
||||
*target = *t;
|
||||
}
|
||||
|
||||
bool menu_animation_push(struct menu_animation_t *animation,
|
||||
bool menu_animation_push(menu_animation_t *anim,
|
||||
float duration,
|
||||
float target_value, float* subject,
|
||||
enum menu_animation_easing_type easing_enum,
|
||||
int tag, tween_cb cb)
|
||||
{
|
||||
struct tween t;
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
|
||||
if (!subject)
|
||||
return false;
|
||||
@ -521,7 +517,7 @@ bool menu_animation_push(struct menu_animation_t *animation,
|
||||
}
|
||||
|
||||
static int menu_animation_iterate(
|
||||
struct menu_animation *anim, unsigned idx,
|
||||
menu_animation_t *anim, unsigned idx,
|
||||
float dt, unsigned *active_tweens)
|
||||
{
|
||||
struct tween *tween = &anim->list[idx];
|
||||
@ -555,11 +551,10 @@ static int menu_animation_iterate(
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool menu_animation_update(struct menu_animation_t *animation, float dt)
|
||||
bool menu_animation_update(menu_animation_t *anim, float dt)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned active_tweens = 0;
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
|
||||
for(i = 0; i < anim->size; i++)
|
||||
menu_animation_iterate(anim, i, dt, &active_tweens);
|
||||
@ -624,7 +619,7 @@ void menu_animation_ticker_generic(uint64_t idx, int max_width,
|
||||
void menu_animation_ticker_str(char *s, size_t len, uint64_t idx,
|
||||
const char *str, bool selected)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
int str_len = strlen(str);
|
||||
int offset = 0;
|
||||
|
||||
@ -652,7 +647,7 @@ void menu_animation_update_time(void)
|
||||
{
|
||||
static retro_time_t last_clock_update = 0;
|
||||
menu_display_t *disp = menu_display_get_ptr();
|
||||
struct menu_animation *anim = (struct menu_animation*)disp->animation;
|
||||
menu_animation_t *anim = disp->animation;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
anim->cur_time = rarch_get_time_usec();
|
||||
@ -672,41 +667,37 @@ void menu_animation_update_time(void)
|
||||
}
|
||||
}
|
||||
|
||||
void menu_animation_set_active(struct menu_animation_t *animation)
|
||||
void menu_animation_set_active(menu_animation_t *anim)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
if (!anim)
|
||||
return;
|
||||
anim->is_active = true;
|
||||
}
|
||||
|
||||
void menu_animation_clear_active(struct menu_animation_t *animation)
|
||||
void menu_animation_clear_active(menu_animation_t *anim)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
if (!anim)
|
||||
return;
|
||||
anim->is_active = false;
|
||||
}
|
||||
|
||||
float menu_animation_get_delta_time(struct menu_animation_t *animation)
|
||||
float menu_animation_get_delta_time(menu_animation_t *anim)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
if (!anim)
|
||||
return 0.0f;
|
||||
return anim->delta_time;
|
||||
}
|
||||
|
||||
struct menu_animation_t *menu_animation_init(void)
|
||||
menu_animation_t *menu_animation_init(void)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)calloc(1, sizeof(*anim));
|
||||
menu_animation_t *anim = (menu_animation_t*)calloc(1, sizeof(*anim));
|
||||
if (!anim)
|
||||
return NULL;
|
||||
return (struct menu_animation_t*)anim;
|
||||
return (menu_animation_t*)anim;
|
||||
}
|
||||
|
||||
bool menu_animation_is_active(struct menu_animation_t *animation)
|
||||
bool menu_animation_is_active(menu_animation_t *anim)
|
||||
{
|
||||
struct menu_animation *anim = (struct menu_animation*)animation;
|
||||
if (!anim)
|
||||
return false;
|
||||
return anim->is_active;
|
||||
|
@ -33,7 +33,7 @@ extern "C" {
|
||||
typedef float (*easingFunc)(float, float, float, float);
|
||||
typedef void (*tween_cb) (void);
|
||||
|
||||
struct menu_animation_t;
|
||||
typedef struct menu_animation menu_animation_t;
|
||||
|
||||
enum menu_animation_easing_type
|
||||
{
|
||||
@ -81,24 +81,24 @@ enum menu_animation_easing_type
|
||||
EASING_OUT_IN_BOUNCE
|
||||
};
|
||||
|
||||
void menu_animation_free(struct menu_animation_t *animation);
|
||||
void menu_animation_free(menu_animation_t *animation);
|
||||
|
||||
void menu_animation_kill_by_subject(
|
||||
struct menu_animation_t *animation,
|
||||
menu_animation_t *animation,
|
||||
size_t count,
|
||||
const void *subjects);
|
||||
|
||||
void menu_animation_kill_by_tag(struct menu_animation_t *anim, int tag);
|
||||
void menu_animation_kill_by_tag(menu_animation_t *anim, int tag);
|
||||
|
||||
/* Use -1 for untagged */
|
||||
bool menu_animation_push(
|
||||
struct menu_animation_t *animation,
|
||||
menu_animation_t *animation,
|
||||
float duration,
|
||||
float target_value, float* subject,
|
||||
enum menu_animation_easing_type easing_enum,
|
||||
int tag, tween_cb cb);
|
||||
|
||||
bool menu_animation_update(struct menu_animation_t *animation, float dt);
|
||||
bool menu_animation_update(menu_animation_t *animation, float dt);
|
||||
|
||||
/**
|
||||
* menu_animation_ticker_str:
|
||||
@ -117,19 +117,19 @@ void menu_animation_ticker_str(char *s, size_t len, uint64_t tick,
|
||||
void menu_animation_ticker_generic(uint64_t idx, int max_width,
|
||||
int *offset, int *width);
|
||||
|
||||
struct menu_animation_t *menu_animation_get_ptr(void);
|
||||
menu_animation_t *menu_animation_get_ptr(void);
|
||||
|
||||
void menu_animation_update_time(void);
|
||||
|
||||
void menu_animation_set_active(struct menu_animation_t *anim);
|
||||
void menu_animation_set_active(menu_animation_t *anim);
|
||||
|
||||
void menu_animation_clear_active(struct menu_animation_t *anim);
|
||||
void menu_animation_clear_active(menu_animation_t *anim);
|
||||
|
||||
float menu_animation_get_delta_time(struct menu_animation_t *anim);
|
||||
float menu_animation_get_delta_time(menu_animation_t *anim);
|
||||
|
||||
bool menu_animation_is_active(struct menu_animation_t *anim);
|
||||
bool menu_animation_is_active(menu_animation_t *anim);
|
||||
|
||||
struct menu_animation_t *menu_animation_init(void);
|
||||
menu_animation_t *menu_animation_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void menu_display_fb(void)
|
||||
|
||||
bool menu_display_update_pending(void)
|
||||
{
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
|
||||
if (menu_animation_is_active(anim) || (frame_buf && frame_buf->dirty))
|
||||
|
@ -43,7 +43,7 @@ typedef struct menu_display
|
||||
bool msg_force;
|
||||
|
||||
menu_framebuf_t frame_buf;
|
||||
struct menu_animation_t *animation;
|
||||
menu_animation_t *animation;
|
||||
|
||||
struct
|
||||
{
|
||||
|
@ -574,7 +574,7 @@ static int menu_input_mouse(unsigned *action)
|
||||
{
|
||||
video_viewport_t vp;
|
||||
const struct retro_keybind *binds[MAX_USERS];
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
menu_framebuf_t *frame_buf= menu_display_fb_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -662,7 +662,7 @@ static int menu_input_pointer(unsigned *action)
|
||||
int pointer_device, pointer_x, pointer_y;
|
||||
const struct retro_keybind *binds[MAX_USERS] = {NULL};
|
||||
menu_input_t *menu_input = menu_input_get_ptr();
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_framebuf_t *frame_buf= menu_display_fb_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
driver_t *driver = driver_get_ptr();
|
||||
|
@ -1177,7 +1177,7 @@ static void setting_get_string_representation_st_float_video_refresh_rate_auto(v
|
||||
|
||||
if (video_monitor_fps_statistics(&video_refresh_rate, &deviation, &sample_points))
|
||||
{
|
||||
struct menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
|
||||
snprintf(s, len, "%.3f Hz (%.1f%% dev, %u samples)",
|
||||
video_refresh_rate, 100.0 * deviation, sample_points);
|
||||
|
Loading…
x
Reference in New Issue
Block a user