version 2, including all changes.
.
Rev |
Author |
# |
Line |
2 |
perry |
1 |
SDL_!AddTimer |
|
|
2 |
!!!SDL_!AddTimer |
1 |
perry |
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
CALLBACK |
|
|
6 |
DESCRIPTION |
|
|
7 |
RETURN VALUE |
|
|
8 |
EXAMPLES |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
2 |
perry |
14 |
SDL_!AddTimer- Add a timer which will call a callback after the specified number of milliseconds has elapsed. |
1 |
perry |
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include __ |
|
|
19 |
|
|
|
20 |
|
2 |
perry |
21 |
__SDL_TimerID SDL_!AddTimer__(__Uint32 interval, |
|
|
22 |
SDL_!NewTimerCallback callback, void |
1 |
perry |
23 |
*param__); |
|
|
24 |
!!CALLBACK |
|
|
25 |
|
|
|
26 |
|
|
|
27 |
/* type definition for the |
|
|
28 |
!!DESCRIPTION |
|
|
29 |
|
|
|
30 |
|
|
|
31 |
Adds a callback function to be run after the specified |
|
|
32 |
number of milliseconds has elapsed. The callback function is |
|
|
33 |
passed the current timer interval and the user supplied |
2 |
perry |
34 |
parameter from the __SDL_!AddTimer__ call and returns the |
1 |
perry |
35 |
next timer interval. If the returned value from the callback |
|
|
36 |
is the same as the one passed in, the periodic alarm |
|
|
37 |
continues, otherwise a new alarm is scheduled. |
|
|
38 |
|
|
|
39 |
|
|
|
40 |
To cancel a currently running timer call |
2 |
perry |
41 |
''SDL_!RemoveTimer'' with the timer ID returned from |
|
|
42 |
__SDL_!AddTimer__. |
1 |
perry |
43 |
|
|
|
44 |
|
|
|
45 |
The timer callback function may run in a different thread |
|
|
46 |
than your main program, and so shouldn't call any functions |
|
|
47 |
from within itself. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
The maximum resolution of this timer is 10 ms, which means |
|
|
51 |
that if you request a 16 ms timer, your callback will run |
|
|
52 |
approximately 20 ms later on an unloaded system. If you |
|
|
53 |
wanted to set a flag signaling a frame update at 30 frames |
|
|
54 |
per second (every 33 ms), you might set a timer for 30 ms |
|
|
55 |
(see example below). If you use this function, you need to |
|
|
56 |
pass __SDL_INIT_TIMER__ to ''SDL_Init''. |
|
|
57 |
!!RETURN VALUE |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
Returns an ID value for the added timer or __NULL__ if |
|
|
61 |
there was an error. |
|
|
62 |
!!EXAMPLES |
|
|
63 |
|
|
|
64 |
|
2 |
perry |
65 |
my_timer_id = SDL_!AddTimer((33/10)*10, my_callbackfunc, my_callback_param); |
1 |
perry |
66 |
!!SEE ALSO |
|
|
67 |
|
|
|
68 |
|
2 |
perry |
69 |
__SDL_!RemoveTimer__ |
1 |
perry |
70 |
---- |