annotate docs/ref/Clock.html @ 457:c7745825439b

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