Make TimerState private;

This commit is contained in:
bjorn 2019-05-13 03:35:41 -07:00
parent 963f496ac1
commit 97e3774718
2 changed files with 12 additions and 14 deletions

View File

@ -2,7 +2,17 @@
#include "platform.h"
#include <string.h>
static TimerState state;
static struct {
bool initialized;
double lastTime;
double time;
double dt;
int tickIndex;
double tickSum;
double tickBuffer[TICK_SAMPLES];
double averageDelta;
int fps;
} state;
bool lovrTimerInit() {
if (state.initialized) return false;
@ -12,7 +22,7 @@ bool lovrTimerInit() {
void lovrTimerDestroy() {
if (!state.initialized) return;
memset(&state, 0, sizeof(TimerState));
memset(&state, 0, sizeof(state));
}
double lovrTimerGetDelta() {

View File

@ -4,18 +4,6 @@
#define TICK_SAMPLES 90
typedef struct {
bool initialized;
double lastTime;
double time;
double dt;
int tickIndex;
double tickSum;
double tickBuffer[TICK_SAMPLES];
double averageDelta;
int fps;
} TimerState;
bool lovrTimerInit(void);
void lovrTimerDestroy(void);
double lovrTimerGetDelta(void);