Mercurial > sdl-ios-xcode
comparison include/SDL_timer.h @ 1668:4da1ee79c9af SDL-1.3
more tweaking indent options
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 29 May 2006 04:04:35 +0000 |
parents | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
47 #define TIMER_RESOLUTION 10 /* Experimentally determined */ | 47 #define TIMER_RESOLUTION 10 /* Experimentally determined */ |
48 | 48 |
49 /* Get the number of milliseconds since the SDL library initialization. | 49 /* Get the number of milliseconds since the SDL library initialization. |
50 * Note that this value wraps if the program runs for more than ~49 days. | 50 * Note that this value wraps if the program runs for more than ~49 days. |
51 */ | 51 */ |
52 extern DECLSPEC Uint32 SDLCALL SDL_GetTicks (void); | 52 extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); |
53 | 53 |
54 /* Wait a specified number of milliseconds before returning */ | 54 /* Wait a specified number of milliseconds before returning */ |
55 extern DECLSPEC void SDLCALL SDL_Delay (Uint32 ms); | 55 extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); |
56 | 56 |
57 /* Function prototype for the timer callback function */ | 57 /* Function prototype for the timer callback function */ |
58 typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval); | 58 typedef Uint32(SDLCALL * SDL_TimerCallback) (Uint32 interval); |
59 | 59 |
60 /* Set a callback to run after the specified number of milliseconds has | 60 /* Set a callback to run after the specified number of milliseconds has |
61 * elapsed. The callback function is passed the current timer interval | 61 * elapsed. The callback function is passed the current timer interval |
62 * and returns the next timer interval. If the returned value is the | 62 * and returns the next timer interval. If the returned value is the |
63 * same as the one passed in, the periodic alarm continues, otherwise a | 63 * same as the one passed in, the periodic alarm continues, otherwise a |
83 * should not use this function in multi-threaded applications as signals | 83 * should not use this function in multi-threaded applications as signals |
84 * to multi-threaded apps have undefined behavior in some implementations. | 84 * to multi-threaded apps have undefined behavior in some implementations. |
85 * | 85 * |
86 * This function returns 0 if successful, or -1 if there was an error. | 86 * This function returns 0 if successful, or -1 if there was an error. |
87 */ | 87 */ |
88 extern DECLSPEC int SDLCALL SDL_SetTimer (Uint32 interval, | 88 extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, |
89 SDL_TimerCallback callback); | 89 SDL_TimerCallback callback); |
90 | 90 |
91 /* New timer API, supports multiple timers | 91 /* New timer API, supports multiple timers |
92 * Written by Stephane Peter <megastep@lokigames.com> | 92 * Written by Stephane Peter <megastep@lokigames.com> |
93 */ | 93 */ |
94 | 94 |
96 * The callback function is passed the current timer interval and returns | 96 * The callback function is passed the current timer interval and returns |
97 * the next timer interval. If the returned value is the same as the one | 97 * the next timer interval. If the returned value is the same as the one |
98 * passed in, the periodic alarm continues, otherwise a new alarm is | 98 * passed in, the periodic alarm continues, otherwise a new alarm is |
99 * scheduled. If the callback returns 0, the periodic alarm is cancelled. | 99 * scheduled. If the callback returns 0, the periodic alarm is cancelled. |
100 */ | 100 */ |
101 typedef Uint32 (SDLCALL * SDL_NewTimerCallback) (Uint32 interval, | 101 typedef Uint32(SDLCALL * SDL_NewTimerCallback) (Uint32 interval, void *param); |
102 void *param); | |
103 | 102 |
104 /* Definition of the timer ID type */ | 103 /* Definition of the timer ID type */ |
105 typedef struct _SDL_TimerID *SDL_TimerID; | 104 typedef struct _SDL_TimerID *SDL_TimerID; |
106 | 105 |
107 /* Add a new timer to the pool of timers already running. | 106 /* Add a new timer to the pool of timers already running. |
108 Returns a timer ID, or NULL when an error occurs. | 107 Returns a timer ID, or NULL when an error occurs. |
109 */ | 108 */ |
110 extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer (Uint32 interval, | 109 extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, |
111 SDL_NewTimerCallback | 110 SDL_NewTimerCallback |
112 callback, void *param); | 111 callback, void *param); |
113 | 112 |
114 /* Remove one of the multiple timers knowing its ID. | 113 /* Remove one of the multiple timers knowing its ID. |
115 * Returns a boolean value indicating success. | 114 * Returns a boolean value indicating success. |
116 */ | 115 */ |
117 extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer (SDL_TimerID t); | 116 extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); |
118 | 117 |
119 /* Ends C function definitions when using C++ */ | 118 /* Ends C function definitions when using C++ */ |
120 #ifdef __cplusplus | 119 #ifdef __cplusplus |
121 /* *INDENT-OFF* */ | 120 /* *INDENT-OFF* */ |
122 } | 121 } |