Metadata-Version: 2.1
Name: tcod-clock
Version: 1.0.1
Summary: Track and limit framerate of a program.
Author-email: Kyle Benesch <4b796c65+github@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Project-URL: Changelog, https://github.com/HexDecimal/python-tcod-clock/blob/main/CHANGELOG.md
Project-URL: Documentation, https://python-tcod-clock.readthedocs.io
Project-URL: Home, https://github.com/HexDecimal/python-tcod-clock
Project-URL: Source, https://github.com/HexDecimal/python-tcod-clock

# About

[![PyPI](https://img.shields.io/pypi/v/tcod-clock)](https://pypi.org/project/tcod-clock/)
[![PyPI - License](https://img.shields.io/pypi/l/tcod-clock)](https://github.com/HexDecimal/python-tcod-clock/blob/main/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/python-tcod-clock/badge/?version=latest)](https://python-tcod-clock.readthedocs.io)
[![codecov](https://codecov.io/gh/HexDecimal/python-tcod-clock/branch/main/graph/badge.svg?token=UP161WEo0s)](https://codecov.io/gh/HexDecimal/python-tcod-clock)

Libtcod used to include a global framerate limiter which was eventually deprecated.
This module was created as a replacement for that feature.

```py
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=}")
```

