mirror of
https://github.com/yawut/SDL.git
synced 2026-09-08 00:56:24 -05:00
File style cleanup for the SDL 2.0 release
This commit is contained in:
@@ -336,7 +336,7 @@ SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param)
|
||||
timer->interval = interval;
|
||||
timer->scheduled = SDL_GetTicks() + interval;
|
||||
timer->canceled = SDL_FALSE;
|
||||
|
||||
|
||||
entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry));
|
||||
if (!entry) {
|
||||
SDL_free(timer);
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
/* Useful functions and variables from SDL_timer.c */
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#define ROUND_RESOLUTION(X) \
|
||||
(((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
|
||||
#define ROUND_RESOLUTION(X) \
|
||||
(((X+TIMER_RESOLUTION-1)/TIMER_RESOLUTION)*TIMER_RESOLUTION)
|
||||
|
||||
extern void SDL_InitTicks(void);
|
||||
extern int SDL_TimerInit(void);
|
||||
|
||||
@@ -32,17 +32,17 @@ static struct timeval start;
|
||||
|
||||
void SDL_StartTicks(void)
|
||||
{
|
||||
gettimeofday(&start, NULL);
|
||||
gettimeofday(&start, NULL);
|
||||
}
|
||||
|
||||
Uint32 SDL_GetTicks(void)
|
||||
{
|
||||
struct timeval now;
|
||||
Uint32 ticks;
|
||||
struct timeval now;
|
||||
Uint32 ticks;
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
|
||||
return(ticks);
|
||||
gettimeofday(&now, NULL);
|
||||
ticks=(now.tv_sec-start.tv_sec)*1000+(now.tv_usec-start.tv_usec)/1000;
|
||||
return(ticks);
|
||||
}
|
||||
|
||||
Uint64
|
||||
@@ -59,10 +59,10 @@ SDL_GetPerformanceFrequency(void)
|
||||
|
||||
void SDL_Delay(Uint32 ms)
|
||||
{
|
||||
const Uint32 max_delay = 0xffffffffUL / 1000;
|
||||
if(ms > max_delay)
|
||||
ms = max_delay;
|
||||
sceKernelDelayThreadCB(ms * 1000);
|
||||
const Uint32 max_delay = 0xffffffffUL / 1000;
|
||||
if(ms > max_delay)
|
||||
ms = max_delay;
|
||||
sceKernelDelayThreadCB(ms * 1000);
|
||||
}
|
||||
|
||||
/* vim: ts=4 sw=4
|
||||
|
||||
@@ -85,7 +85,7 @@ SDL_GetTicks(void)
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
ticks =
|
||||
ticks =
|
||||
(now.tv_sec - start_ts.tv_sec) * 1000 + (now.tv_nsec -
|
||||
start_ts.tv_nsec) / 1000000;
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "SDL_timer.h"
|
||||
|
||||
#define TIME_WRAP_VALUE (~(DWORD)0)
|
||||
#define TIME_WRAP_VALUE (~(DWORD)0)
|
||||
|
||||
/* The first (low-resolution) ticks value of the application */
|
||||
static DWORD start;
|
||||
@@ -48,7 +48,7 @@ SDL_StartTicks(void)
|
||||
#ifdef USE_GETTICKCOUNT
|
||||
start = GetTickCount();
|
||||
#else
|
||||
/* QueryPerformanceCounter has had problems in the past, but lots of games
|
||||
/* QueryPerformanceCounter has had problems in the past, but lots of games
|
||||
use it, so we'll rely on it here.
|
||||
*/
|
||||
if (QueryPerformanceFrequency(&hires_ticks_per_second) == TRUE) {
|
||||
|
||||
Reference in New Issue
Block a user