mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Move some more variables to menu_animation_t
This commit is contained in:
parent
70cf98eadc
commit
58d7c0fd3b
@ -424,7 +424,7 @@ static void menu_action_setting_disp_set_label_perf_counters(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
const struct retro_perf_counter **counters =
|
||||
(const struct retro_perf_counter **)perf_counters_rarch;
|
||||
unsigned offset = type - MENU_SETTINGS_PERF_COUNTERS_BEGIN;
|
||||
@ -436,7 +436,7 @@ static void menu_action_setting_disp_set_label_perf_counters(
|
||||
menu_action_setting_disp_set_label_perf_counters_common(
|
||||
counters, offset, s, len);
|
||||
|
||||
menu->label.is_updated = true;
|
||||
anim->label.is_updated = true;
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_libretro_perf_counters(
|
||||
@ -448,7 +448,7 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters(
|
||||
const char *path,
|
||||
char *s2, size_t len2)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
const struct retro_perf_counter **counters =
|
||||
(const struct retro_perf_counter **)perf_counters_libretro;
|
||||
unsigned offset = type - MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN;
|
||||
@ -460,7 +460,7 @@ static void menu_action_setting_disp_set_label_libretro_perf_counters(
|
||||
menu_action_setting_disp_set_label_perf_counters_common(
|
||||
counters, offset, s, len);
|
||||
|
||||
menu->label.is_updated = true;
|
||||
anim->label.is_updated = true;
|
||||
}
|
||||
|
||||
static void menu_action_setting_disp_set_label_menu_more(
|
||||
|
@ -398,7 +398,7 @@ static void glui_frame(void)
|
||||
width, glui->line_height, 1, 1, 1, 0.1);
|
||||
|
||||
anim->is_active = true;
|
||||
menu->label.is_updated = false;
|
||||
anim->label.is_updated = false;
|
||||
|
||||
glui_render_quad(gl, 0, 0, width,
|
||||
disp->header_height, 0.2, 0.2, 0.2, 1);
|
||||
|
@ -373,7 +373,7 @@ static void rgui_render(void)
|
||||
/* ensures the framebuffer will be rendered on the screen */
|
||||
menu_display_fb_set_dirty();
|
||||
anim->is_active = false;
|
||||
menu->label.is_updated = false;
|
||||
anim->label.is_updated = false;
|
||||
|
||||
if (settings->menu.pointer.enable)
|
||||
{
|
||||
|
@ -1270,7 +1270,7 @@ static void xmb_render(void)
|
||||
}
|
||||
|
||||
anim->is_active = false;
|
||||
menu->label.is_updated = false;
|
||||
anim->label.is_updated = false;
|
||||
}
|
||||
|
||||
static void xmb_frame_horizontal_list(xmb_handle_t *xmb, menu_handle_t *menu, gl_t *gl)
|
||||
|
19
menu/menu.c
19
menu/menu.c
@ -24,8 +24,8 @@
|
||||
#include "../dynamic.h"
|
||||
#include "../general.h"
|
||||
#include "../frontend/frontend.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../performance.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../performance.h"
|
||||
|
||||
static void menu_environment_get(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
@ -294,7 +294,6 @@ void menu_free(menu_handle_t *menu)
|
||||
int menu_iterate(retro_input_t input,
|
||||
retro_input_t old_input, retro_input_t trigger_input)
|
||||
{
|
||||
static retro_time_t last_clock_update = 0;
|
||||
int32_t ret = 0;
|
||||
unsigned action = 0;
|
||||
runloop_t *runloop = rarch_main_get_ptr();
|
||||
@ -303,20 +302,8 @@ int menu_iterate(retro_input_t input,
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
menu_input->joypad.state = menu_input_frame(input, trigger_input);
|
||||
menu->animation->cur_time = rarch_get_time_usec();
|
||||
menu->animation->delta_time = menu->animation->cur_time - menu->animation->old_time;
|
||||
|
||||
if (menu->animation->delta_time >= IDEAL_DT * 4)
|
||||
menu->animation->delta_time = IDEAL_DT * 4;
|
||||
if (menu->animation->delta_time <= IDEAL_DT / 4)
|
||||
menu->animation->delta_time = IDEAL_DT / 4;
|
||||
menu->animation->old_time = menu->animation->cur_time;
|
||||
|
||||
if (menu->animation->cur_time - last_clock_update > 1000000 && settings->menu.timedate_enable)
|
||||
{
|
||||
menu->label.is_updated = true;
|
||||
last_clock_update = menu->animation->cur_time;
|
||||
}
|
||||
menu_animation_update_time(menu->animation);
|
||||
|
||||
action = menu_input->joypad.state;
|
||||
|
||||
|
@ -52,10 +52,6 @@
|
||||
#define MENU_SETTINGS_CORE_OPTION_NONE 0xffff
|
||||
#define MENU_SETTINGS_CORE_OPTION_START 0x10000
|
||||
|
||||
#ifndef IDEAL_DT
|
||||
#define IDEAL_DT (1.0 / 60.0 * 1000000.0)
|
||||
#endif
|
||||
|
||||
#define MENU_KEYBOARD_BIND_TIMEOUT_SECONDS 5
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -20,7 +20,9 @@
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#include "menu_animation.h"
|
||||
#include "../configuration.h"
|
||||
#include "../runloop.h"
|
||||
#include "../performance.h"
|
||||
|
||||
menu_animation_t *menu_animation_get_ptr(void)
|
||||
{
|
||||
@ -531,3 +533,24 @@ void menu_animation_ticker_line(char *s, size_t len, uint64_t idx,
|
||||
|
||||
anim->is_active = true;
|
||||
}
|
||||
|
||||
void menu_animation_update_time(menu_animation_t *anim)
|
||||
{
|
||||
static retro_time_t last_clock_update = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
anim->cur_time = rarch_get_time_usec();
|
||||
anim->delta_time = anim->cur_time - anim->old_time;
|
||||
|
||||
if (anim->delta_time >= IDEAL_DT * 4)
|
||||
anim->delta_time = IDEAL_DT * 4;
|
||||
if (anim->delta_time <= IDEAL_DT / 4)
|
||||
anim->delta_time = IDEAL_DT / 4;
|
||||
anim->old_time = anim->cur_time;
|
||||
|
||||
if (anim->cur_time - last_clock_update > 1000000 && settings->menu.timedate_enable)
|
||||
{
|
||||
anim->label.is_updated = true;
|
||||
last_clock_update = anim->cur_time;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,10 @@
|
||||
#include <boolean.h>
|
||||
#include "../libretro.h"
|
||||
|
||||
#ifndef IDEAL_DT
|
||||
#define IDEAL_DT (1.0 / 60.0 * 1000000.0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -53,6 +57,11 @@ typedef struct menu_animation
|
||||
float delta_time;
|
||||
retro_time_t cur_time;
|
||||
retro_time_t old_time;
|
||||
|
||||
struct
|
||||
{
|
||||
bool is_updated;
|
||||
} label;
|
||||
} menu_animation_t;
|
||||
|
||||
enum menu_animation_easing_type
|
||||
@ -135,6 +144,8 @@ void menu_animation_ticker_line(char *buf, size_t len, uint64_t tick,
|
||||
|
||||
menu_animation_t *menu_animation_get_ptr(void);
|
||||
|
||||
void menu_animation_update_time(menu_animation_t *anim);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -94,17 +94,13 @@ void menu_display_fb(void)
|
||||
|
||||
bool menu_display_update_pending(void)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
menu_framebuf_t *frame_buf = menu_display_fb_get_ptr();
|
||||
|
||||
if (menu)
|
||||
{
|
||||
if (anim->is_active || menu->label.is_updated)
|
||||
return true;
|
||||
if (frame_buf && frame_buf->dirty)
|
||||
return true;
|
||||
}
|
||||
if ((anim && anim->is_active) || (anim && anim->label.is_updated))
|
||||
return true;
|
||||
if (frame_buf && frame_buf->dirty)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -92,11 +92,6 @@ typedef struct
|
||||
|
||||
menu_input_t input;
|
||||
|
||||
struct
|
||||
{
|
||||
bool is_updated;
|
||||
} label;
|
||||
|
||||
struct
|
||||
{
|
||||
bool active;
|
||||
|
@ -1371,10 +1371,10 @@ 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_handle_t *menu = menu_driver_get_ptr();
|
||||
menu_animation_t *anim = menu_animation_get_ptr();
|
||||
|
||||
if (menu)
|
||||
menu->label.is_updated = true;
|
||||
if (anim)
|
||||
anim->label.is_updated = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user