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 51bbf34abf
commit 908e617900
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.

View File

@@ -26,6 +26,7 @@
#define ROUND_RESOLUTION(X) \
(((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
extern void SDL_InitTicks(void);
extern int SDL_TimerInit(void);
extern void SDL_TimerQuit(void);