Track and limit framerate of a program.
Project description
About
Libtcod used to include a global framerate limiter which was eventually deprecated. This module was created as a replacement for that feature.
import time
import tcod.clock
FPS = 30
end_time = time.time() + 3 # Loop for 3 seconds.
clock = tcod.clock.Clock()
while time.time() < end_time:
clock.sync(1 / FPS) # This loop will run at 30 FPS until interrupted.
# Timing information can be checked. Check the docs for more info.
print(f"{clock.last_fps=}")
print(f"{clock.min_fps=}")
print(f"{clock.max_fps=}")
print(f"{clock.mean_fps=}")
print(f"{clock.median_fps=}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tcod-clock-1.0.1.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for tcod_clock-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80ec3d3948a6397f0e7667612d6c8f786ad9a551f7557b3f2027fc99c8d8ac46 |
|
MD5 | c0482f1b8de9711370d2e39e707a0ea3 |
|
BLAKE2b-256 | 9aef633aac2b1663b1af760ac201d3f0224f25a3b6417359a729520061ec80fd |