WinRT: merged with SDL 2.0.1 codebase

This commit is contained in:
David Ludwig
2013-10-27 21:26:46 -04:00
343 changed files with 12735 additions and 7248 deletions

View File

@@ -26,8 +26,6 @@
#include "SDL_cpuinfo.h"
#include "SDL_thread.h"
extern void SDL_StartTicks(void);
/* #define DEBUG_TIMERS */
typedef struct _SDL_Timer
@@ -72,17 +70,6 @@ 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

@@ -27,10 +27,16 @@
#include "SDL_timer.h"
static bigtime_t start;
static SDL_bool ticks_started = SDL_FALSE;
void
SDL_StartTicks(void)
SDL_InitTicks(void)
{
if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
/* Set first ticks value */
start = system_time();
}
@@ -38,6 +44,10 @@ SDL_StartTicks(void)
Uint32
SDL_GetTicks(void)
{
if (!ticks_started) {
SDL_InitTicks();
}
return ((system_time() - start) / 1000);
}

View File

@@ -24,14 +24,24 @@
#include "SDL_timer.h"
static SDL_bool ticks_started = SDL_FALSE;
void
SDL_StartTicks(void)
SDL_InitTicks(void)
{
if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
}
Uint32
SDL_GetTicks(void)
{
if (!ticks_started) {
SDL_InitTicks();
}
SDL_Unsupported();
return 0;
}

View File

@@ -29,14 +29,24 @@
#include <pspthreadman.h>
static struct timeval start;
static SDL_bool ticks_started = SDL_FALSE;
void SDL_StartTicks(void)
void SDL_InitTicks(void)
{
if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
gettimeofday(&start, NULL);
}
Uint32 SDL_GetTicks(void)
{
if (!ticks_started) {
SDL_InitTicks();
}
struct timeval now;
Uint32 ticks;

View File

@@ -56,10 +56,16 @@ mach_timebase_info_data_t mach_base_info;
#endif
static SDL_bool has_monotonic_time = SDL_FALSE;
static struct timeval start_tv;
static SDL_bool ticks_started = SDL_FALSE;
void
SDL_StartTicks(void)
SDL_InitTicks(void)
{
if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
/* Set first ticks value */
#if HAVE_CLOCK_GETTIME
if (clock_gettime(CLOCK_MONOTONIC, &start_ts) == 0) {
@@ -81,6 +87,10 @@ Uint32
SDL_GetTicks(void)
{
Uint32 ticks;
if (!ticks_started) {
SDL_InitTicks();
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
struct timespec now;
@@ -106,6 +116,10 @@ Uint64
SDL_GetPerformanceCounter(void)
{
Uint64 ticks;
if (!ticks_started) {
SDL_InitTicks();
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
struct timespec now;
@@ -131,6 +145,10 @@ SDL_GetPerformanceCounter(void)
Uint64
SDL_GetPerformanceFrequency(void)
{
if (!ticks_started) {
SDL_InitTicks();
}
if (has_monotonic_time) {
#if HAVE_CLOCK_GETTIME
return 1000000000;
@@ -140,9 +158,9 @@ SDL_GetPerformanceFrequency(void)
freq /= mach_base_info.numer;
return freq;
#endif
} else {
return 1000000;
}
}
return 1000000;
}
void

View File

@@ -31,6 +31,7 @@
/* The first (low-resolution) ticks value of the application */
static DWORD start;
static BOOL ticks_started = FALSE;
#ifndef USE_GETTICKCOUNT
/* Store if a high-resolution performance counter exists on the system */
@@ -78,8 +79,13 @@ SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValu
#endif /* ifndef __WINRT__ */
void
SDL_StartTicks(void)
SDL_InitTicks(void)
{
if (ticks_started) {
return;
}
ticks_started = TRUE;
/* Set first ticks value */
#ifdef USE_GETTICKCOUNT
start = GetTickCount();
@@ -115,6 +121,10 @@ SDL_GetTicks(void)
LARGE_INTEGER hires_now;
#endif
if (!ticks_started) {
SDL_InitTicks();
}
#ifdef USE_GETTICKCOUNT
now = GetTickCount();
#else