mirror of
https://github.com/yawut/SDL.git
synced 2026-09-13 11:36:32 -05:00
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:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user