Track and limit framerate of a program.
Project description
About
Libtcod used to include a global framerate limiter which was later deprecated as libtcod was refactored. This module was crated as a replacement for that feature.
import time
from tcod.clock import Clock
FPS = 30
end_time = time.time() + 3 # Loop for 3 seconds.
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.0.tar.gz
(12.1 kB
view hashes)
Built Distribution
Close
Hashes for tcod_clock-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d99572a31d52804cdda1a737bb4279b6b5301ae376fb9840b34184b25cfe7808 |
|
MD5 | 030462da77a2662dd14f1ea4f8773755 |
|
BLAKE2b-256 | 0c25661788369adc85edb3dd458472b28501d0823ac1486893a4fb0cef51e589 |