★ wanayoo — archive 1999 https://github.com/libtcod/python-tcod/issues/97Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the FPS with the new API #97

Open
Darky-Lucera opened this issue Jul 30, 2020 · 2 comments
Open

Limit the FPS with the new API #97

Darky-Lucera opened this issue Jul 30, 2020 · 2 comments
Labels

Comments

@Darky-Lucera
Copy link

@Darky-Lucera Darky-Lucera commented Jul 30, 2020

I'm trying to modernize my roguelike source code using the new API and I cannot find a method to limit the FPS.
In the old version I was doing:

tcod.sys_set_fps(20)

Is there any way to do this with the new API?
Instead of doing it manually from my code skipping frames

@HexDecimal
Copy link
Collaborator

@HexDecimal HexDecimal commented Jul 30, 2020

There isn't anything builtin to python-tcod right now. The FPS limit was hard coded into the previous API and the new one doesn't have anything similar. You can take PyGame's Clock if you don't want to write your own limiter, but it isn't hard to write a new one in Python. There was nothing special about the old limiter.

If you're having trouble then I could write something quick right now, but it'd just be a port of Clock.

@Darky-Lucera
Copy link
Author

@Darky-Lucera Darky-Lucera commented Jul 30, 2020 •

just to avoid the deprecated message:

main.py:76: DeprecationWarning: This function is not supported if contexts are being used.
tcod.sys_set_fps(20)

Probably I will do my own, so I can have the effects at 60 FPS and player/enemy states at 20 FPS (60 is too fast for this).

Note: I don't know PyGame but in Python 3.7, the time module gains ns resolution timers.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.