Mercurial > sdl-ios-xcode
annotate include/SDL_timer.h @ 5127:b6c7a6b07ebf
Updated main.c for API changes
Kees Bakker to sdl
The main.c for the template is still targeting SDL1.2. Here
is the patch to make it work for SDL1.3 (I'm hoping
the mailing lists accepts attachments.)
In this patch I have also changed the shell script that
assembles the Template. Since there is now only one lib
target (same name for "device" and "simulator" version)
I copy the simulator library to the destination with
the name libSDLSimulator.a. This is not a satisfactory
solution, because both libraries are included in the project
while only one is needed (depending on the selected
environment). However, I'm not fluent with Xcode to
say what a better solution would be.
Kind regards,
Kees Bakker
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 28 Jan 2011 10:37:36 -0800 |
parents | 481dabb098ef |
children | b530ef003506 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3697 | 3 Copyright (C) 1997-2010 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1028
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifndef _SDL_timer_h | |
24 #define _SDL_timer_h | |
25 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
26 /** |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
27 * \file SDL_timer.h |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
28 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
29 * Header for the SDL time management routines. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
30 */ |
0 | 31 |
1356
67114343400d
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
32 #include "SDL_stdinc.h" |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1356
diff
changeset
|
33 #include "SDL_error.h" |
0 | 34 |
35 #include "begin_code.h" | |
36 /* Set up for C function definitions, even when using C++ */ | |
37 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
38 /* *INDENT-OFF* */ |
0 | 39 extern "C" { |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
40 /* *INDENT-ON* */ |
0 | 41 #endif |
42 | |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
43 /** |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
44 * \brief Get the number of milliseconds since the SDL library initialization. |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
45 * |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
46 * \note This value wraps if the program runs for more than ~49 days. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
47 */ |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
48 extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void); |
0 | 49 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
50 /** |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
51 * \brief Wait a specified number of milliseconds before returning. |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
52 */ |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
53 extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms); |
0 | 54 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
55 /** |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
56 * Function prototype for the timer callback function. |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
57 * |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
58 * The callback function is passed the current timer interval and returns |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
59 * the next timer interval. If the returned value is the same as the one |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
60 * passed in, the periodic alarm continues, otherwise a new alarm is |
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
61 * scheduled. If the callback returns 0, the periodic alarm is cancelled. |
0 | 62 */ |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
63 typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); |
0 | 64 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
65 /** |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
66 * Definition of the timer ID type. |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
67 */ |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
68 typedef int SDL_TimerID; |
0 | 69 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
70 /** |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
71 * \brief Add a new timer to the pool of timers already running. |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
72 * |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
73 * \return A timer ID, or NULL when an error occurs. |
0 | 74 */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
75 extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
76 SDL_TimerCallback callback, |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
77 void *param); |
0 | 78 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
79 /** |
5113
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
80 * \brief Remove a timer knowing its ID. |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
81 * |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
82 * \return A boolean value indicating success or failure. |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
83 * |
481dabb098ef
Improved timer implementation
Sam Lantinga <slouken@libsdl.org>
parents:
3697
diff
changeset
|
84 * \warning It is not safe to remove a timer multiple times. |
0 | 85 */ |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
86 extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t); |
0 | 87 |
3407
d3baf5ac4e37
Partial fix for bug #859
Sam Lantinga <slouken@libsdl.org>
parents:
2859
diff
changeset
|
88 |
0 | 89 /* Ends C function definitions when using C++ */ |
90 #ifdef __cplusplus | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
91 /* *INDENT-OFF* */ |
0 | 92 } |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
93 /* *INDENT-ON* */ |
0 | 94 #endif |
95 #include "close_code.h" | |
96 | |
97 #endif /* _SDL_timer_h */ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
98 |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
99 /* vi: set ts=4 sw=4 expandtab: */ |