Mercurial > pygame
view docs/ref/Clock.html @ 457:c7745825439b
trunc fix
| author | pygame |
|---|---|
| date | Mon, 12 May 2003 14:54:13 +0000 |
| parents | f3ef1ecb814a |
| children | 4c398dd9d49b |
line wrap: on
line source
<html> <title>Clock</title> <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111> <table cellspacing=3 width=100%><tr><td bgcolor=#00000> <table width=100%><tr><td bgcolor=c2fc20 align=center> <a href=http://www.pygame.org> <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br> <b>pygame documentation</b> </td><td bgcolor=6aee28 align=center valign=top width=100%> || <a href=http://www.pygame.org>Home</a> || <a href=../index.html>Help Contents</a> || <br> <br> || <a href=pygame.html>pygame</a> || <a href=pygame_cdrom.html>cdrom</a> || <a href=pygame_constants.html>constants</a> || <a href=pygame_display.html>display</a> || <a href=pygame_draw.html>draw</a> || <a href=pygame_event.html>event</a> ||<br> || <a href=pygame_font.html>font</a> || <a href=pygame_image.html>image</a> || <a href=pygame_joystick.html>joystick</a> || <a href=pygame_key.html>key</a> || <a href=pygame_mixer.html>mixer</a> || <a href=pygame_mixer_music.html>mixer_music</a> ||<br> || <a href=pygame_mouse.html>mouse</a> || <a href=pygame_movie.html>movie</a> || <a href=pygame_sndarray.html>sndarray</a> || <a href=pygame_surfarray.html>surfarray</a> || <a href=pygame_time.html>time</a> || <a href=pygame_transform.html>transform</a> ||<br> <br>|| <a href=CD.html>CD</a> || <a href=Channel.html>Channel</a> || <a href=Clock.html>Clock</a> || <a href=Font.html>Font</a> || <a href=Joystick.html>Joystick</a> || <a href=Movie.html>Movie</a> ||<br> || <a href=Rect.html>Rect</a> || <a href=Sound.html>Sound</a> || <a href=Surface.html>Surface</a> ||<br> <br>|| <a href=pygame_cursors.html>cursors</a> || <a href=pygame_sprite.html>sprite</a> ||<br> </td></tr></table></td></tr></table> <br> <h2 align=center>Clock</h2> Clocks are used to track and control the framerate of a game. You create the objects with the time.Clock() function. The clock can be used to limit the framerate of a game, as well as track the time used per frame. Use the <a href=pygame_time.html#Clock>pygame.time.Clock()</a> function to create new Clock objects. <hr> <table> <tr><td><a href=#get_fps>get_fps</a></td><td> - get the current rate of frames per second</td></tr> <tr><td><a href=#get_rawtime>get_rawtime</a></td><td> - get number of nondelayed milliseconds between last two calls to tick()</td></tr> <tr><td><a href=#get_time>get_time</a></td><td> - get number of milliseconds between last two calls to tick()</td></tr> <tr><td><a href=#tick>tick</a></td><td> - control timer events</td></tr> </table> <hr> <a name=get_fps><font size=+2><b>get_fps </b></font><br><font size=+1><tt> Clock.get_fps() -> float </tt></font><ul> This computes the running average of frames per second. This is the number of times the <a href=#tick>tick()</a> method has been called per second. </ul><br> <br> <a name=get_rawtime><font size=+2><b>get_rawtime </b></font><br><font size=+1><tt> Clock.get_rawtime() -> int </tt></font><ul> This is similar to <a href=Movie.html#get_time>get_time()</a>. It does not include the number of milliseconds that were delayed to keep the clock tick under a given framerate. </ul><br> <br> <a name=get_time><font size=+2><b>get_time </b></font><br><font size=+1><tt> Clock.get_time() -> int </tt></font><ul> This is the same value returned from the call to <a href=#tick>Clock.tick()</a>. it is the number of milliseconds that passed between the last two calls to <a href=#tick>tick()</a>. </ul><br> <br> <a name=tick><font size=+2><b>tick </b></font><br><font size=+1><tt> Clock.tick([ticks_per_sec_delay]) -> milliseconds </tt></font><ul> Updates the number of ticks for this clock. It should usually be called once per frame. If you pass the optional delay argument the function will delay to keep the game running slower than the given ticks per second. The function also returns the number of milliseconds passed since the previous call to <u>tick()</u>. </ul><br> <br> <hr> </body></html>
