mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Move static variables to menu handle struct
This commit is contained in:
parent
6e0d769fec
commit
48032486f4
@ -15,11 +15,9 @@
|
||||
*/
|
||||
|
||||
#include "menu_animation.h"
|
||||
#include "../driver.h"
|
||||
#include <math.h>
|
||||
|
||||
static tween_t* tweens = NULL;
|
||||
static int numtweens = 0;
|
||||
|
||||
static void tween_free(tween_t *tw)
|
||||
{
|
||||
if (tw)
|
||||
@ -32,16 +30,17 @@ void add_tween(float duration, float target_value, float* subject,
|
||||
{
|
||||
tween_t *tween = NULL;
|
||||
tween_t *temp_tweens = (tween_t*)
|
||||
realloc(tweens, (numtweens + 1) * sizeof(tween_t));
|
||||
realloc(driver.menu->tweens,
|
||||
(driver.menu->numtweens + 1) * sizeof(tween_t));
|
||||
|
||||
if (!temp_tweens)
|
||||
{
|
||||
tween_free(tweens);
|
||||
tween_free(driver.menu->tweens);
|
||||
return;
|
||||
}
|
||||
|
||||
tweens = temp_tweens;
|
||||
tween = (tween_t*)&tweens[numtweens];
|
||||
driver.menu->tweens = temp_tweens;
|
||||
tween = (tween_t*)&driver.menu->tweens[driver.menu->numtweens];
|
||||
|
||||
if (!tween)
|
||||
return;
|
||||
@ -55,7 +54,7 @@ void add_tween(float duration, float target_value, float* subject,
|
||||
tween->easing = easing;
|
||||
tween->callback = callback;
|
||||
|
||||
numtweens++;
|
||||
driver.menu->numtweens++;
|
||||
}
|
||||
|
||||
void update_tweens(float dt)
|
||||
@ -63,9 +62,9 @@ void update_tweens(float dt)
|
||||
unsigned i;
|
||||
unsigned active_tweens = 0;
|
||||
|
||||
for(i = 0; i < numtweens; i++)
|
||||
for(i = 0; i < driver.menu->numtweens; i++)
|
||||
{
|
||||
tween_t *tween = &tweens[i];
|
||||
tween_t *tween = &driver.menu->tweens[i];
|
||||
if (!tween)
|
||||
continue;
|
||||
if (tween->running_since >= tween->duration)
|
||||
@ -93,7 +92,7 @@ void update_tweens(float dt)
|
||||
}
|
||||
|
||||
if (!active_tweens)
|
||||
numtweens = 0;
|
||||
driver.menu->numtweens = 0;
|
||||
}
|
||||
|
||||
// linear
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <stdint.h>
|
||||
#include <boolean.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include "menu_animation.h"
|
||||
#include "menu_list.h"
|
||||
#include "../settings_list.h"
|
||||
|
||||
@ -139,6 +140,8 @@ typedef struct
|
||||
} keyboard;
|
||||
|
||||
rarch_setting_t *list_settings;
|
||||
tween_t* tweens;
|
||||
int numtweens;
|
||||
} menu_handle_t;
|
||||
|
||||
typedef struct menu_file_list_cbs
|
||||
|
Loading…
x
Reference in New Issue
Block a user