move Ticks initialization tracking to separate function and ensure it's called with SDL_VideoInit is called to init SDL instead of SDL_Init

-- why do we even allow initialization w/o calling at least SDL_Init(0) ?
This commit is contained in:
Edward Rudd 2013-05-02 21:40:59 -04:00
parent 907ac2687c
commit 33660e58c1
4 changed files with 20 additions and 6 deletions

View file

@ -26,6 +26,8 @@
#include "SDL_cpuinfo.h"
#include "SDL_thread.h"
extern void SDL_StartTicks(void);
/* #define DEBUG_TIMERS */
typedef struct _SDL_Timer
@ -70,6 +72,16 @@ typedef struct {
static SDL_TimerData SDL_timer_data;
static Uint32 ticks_started = 0;
void
SDL_InitTicks(void)
{
if (!ticks_started) {
SDL_StartTicks();
ticks_started = 1;
}
}
/* The idea here is that any thread might add a timer, but a single
* thread manages the active timer queue, sorted by scheduling time.