|
277
|
1 <html>
|
|
|
2 <title>Clock</title>
|
|
|
3 <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
|
|
|
4
|
|
|
5
|
|
|
6 <table cellspacing=3 width=100%><tr><td bgcolor=#00000>
|
|
|
7 <table width=100%><tr><td bgcolor=c2fc20 align=center>
|
|
|
8 <a href=http://www.pygame.org>
|
|
|
9 <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
|
|
|
10 <b>pygame documentation</b>
|
|
|
11 </td><td bgcolor=6aee28 align=center valign=top width=100%>
|
|
|
12
|
|
|
13 ||
|
|
|
14 <a href=http://www.pygame.org>Home</a> ||
|
|
|
15 <a href=../index.html>Help Contents</a> ||
|
|
|
16 <br> <br>
|
|
|
17
|
|
384
|
18 || <a href=pygame.html>pygame</a> ||
|
|
277
|
19 <a href=pygame_cdrom.html>cdrom</a> ||
|
|
|
20 <a href=pygame_constants.html>constants</a> ||
|
|
|
21 <a href=pygame_display.html>display</a> ||
|
|
384
|
22 <a href=pygame_draw.html>draw</a> ||
|
|
|
23 <a href=pygame_event.html>event</a> ||<br>
|
|
|
24 || <a href=pygame_font.html>font</a> ||
|
|
277
|
25 <a href=pygame_image.html>image</a> ||
|
|
|
26 <a href=pygame_joystick.html>joystick</a> ||
|
|
|
27 <a href=pygame_key.html>key</a> ||
|
|
384
|
28 <a href=pygame_mixer.html>mixer</a> ||
|
|
|
29 <a href=pygame_mixer_music.html>mixer_music</a> ||<br>
|
|
|
30 || <a href=pygame_mouse.html>mouse</a> ||
|
|
277
|
31 <a href=pygame_movie.html>movie</a> ||
|
|
370
|
32 <a href=pygame_sndarray.html>sndarray</a> ||
|
|
277
|
33 <a href=pygame_surfarray.html>surfarray</a> ||
|
|
384
|
34 <a href=pygame_time.html>time</a> ||
|
|
|
35 <a href=pygame_transform.html>transform</a> ||<br>
|
|
277
|
36 <br>|| <a href=CD.html>CD</a> ||
|
|
|
37 <a href=Channel.html>Channel</a> ||
|
|
|
38 <a href=Clock.html>Clock</a> ||
|
|
|
39 <a href=Font.html>Font</a> ||
|
|
|
40 <a href=Joystick.html>Joystick</a> ||
|
|
|
41 <a href=Movie.html>Movie</a> ||<br>
|
|
|
42 || <a href=Rect.html>Rect</a> ||
|
|
|
43 <a href=Sound.html>Sound</a> ||
|
|
|
44 <a href=Surface.html>Surface</a> ||<br>
|
|
299
|
45 <br>|| <a href=pygame_cursors.html>cursors</a> ||
|
|
375
|
46 <a href=pygame_sprite.html>sprite</a> ||<br>
|
|
277
|
47
|
|
|
48
|
|
|
49 </td></tr></table></td></tr></table>
|
|
|
50 <br>
|
|
|
51 <h2 align=center>Clock</h2>
|
|
|
52 Clocks are used to track and control the framerate
|
|
|
53 of a game. You create the objects with the time.Clock()
|
|
|
54 function. The clock can be used to limit the framerate
|
|
|
55 of a game, as well as track the time used per frame.
|
|
|
56 Use the <a href=pygame_time.html#Clock>pygame.time.Clock()</a> function to create new Clock
|
|
|
57 objects.
|
|
|
58
|
|
|
59 <hr>
|
|
|
60
|
|
|
61 <table>
|
|
|
62 <tr><td><a href=#get_fps>get_fps</a></td><td> -
|
|
|
63 get the current rate of frames per second</td></tr>
|
|
|
64
|
|
|
65
|
|
398
|
66 <tr><td><a href=#get_rawtime>get_rawtime</a></td><td> -
|
|
|
67 get number of nondelayed milliseconds between last two calls to tick()</td></tr>
|
|
|
68
|
|
|
69
|
|
|
70 <tr><td><a href=#get_time>get_time</a></td><td> -
|
|
|
71 get number of milliseconds between last two calls to tick()</td></tr>
|
|
|
72
|
|
|
73
|
|
277
|
74 <tr><td><a href=#tick>tick</a></td><td> -
|
|
|
75 control timer events</td></tr>
|
|
|
76
|
|
|
77
|
|
|
78 </table>
|
|
|
79
|
|
|
80 <hr>
|
|
|
81
|
|
|
82 <a name=get_fps><font size=+2><b>get_fps
|
|
|
83 </b></font><br><font size=+1><tt>
|
|
|
84 Clock.get_fps() -> float
|
|
|
85 </tt></font><ul>
|
|
|
86 This computes the running average of frames per second. This
|
|
|
87 is the number of times the <a href=#tick>tick()</a> method has been called per
|
|
|
88 second.
|
|
|
89 </ul><br> <br>
|
|
|
90
|
|
398
|
91 <a name=get_rawtime><font size=+2><b>get_rawtime
|
|
|
92 </b></font><br><font size=+1><tt>
|
|
|
93 Clock.get_rawtime() -> int
|
|
|
94 </tt></font><ul>
|
|
435
|
95 This is similar to <a href=Movie.html#get_time>get_time()</a>. It does not include the number of
|
|
398
|
96 milliseconds that were delayed to keep the clock tick under a given
|
|
|
97 framerate.
|
|
|
98 </ul><br> <br>
|
|
|
99
|
|
|
100 <a name=get_time><font size=+2><b>get_time
|
|
|
101 </b></font><br><font size=+1><tt>
|
|
|
102 Clock.get_time() -> int
|
|
|
103 </tt></font><ul>
|
|
|
104 This is the same value returned from the call to <a href=#tick>Clock.tick()</a>.
|
|
|
105 it is the number of milliseconds that passed between the last
|
|
|
106 two calls to <a href=#tick>tick()</a>.
|
|
|
107 </ul><br> <br>
|
|
|
108
|
|
277
|
109 <a name=tick><font size=+2><b>tick
|
|
|
110 </b></font><br><font size=+1><tt>
|
|
|
111 Clock.tick([ticks_per_sec_delay]) -> milliseconds
|
|
|
112 </tt></font><ul>
|
|
|
113 Updates the number of ticks for this clock. It should usually
|
|
|
114 be called once per frame. If you pass the optional delay argument
|
|
398
|
115 the function will delay to keep the game running slower than the
|
|
|
116 given ticks per second. The function also returns the number of
|
|
|
117 milliseconds passed since the previous call to <u>tick()</u>.
|
|
277
|
118 </ul><br> <br>
|
|
|
119
|
|
|
120
|
|
|
121 <hr>
|
|
|
122 </body></html>
|