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

add should_draw to Game trait #130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JeanMertz
Copy link

@JeanMertz JeanMertz commented May 18, 2020

I tried to implement an FPS limit solution in my game by returning early from Game::draw if the minimum time between frames wasn't met yet, but noticed that this broke horribly due to Coffee still doing a lot of pre-/post-processing on every draw call.

By exposing Game::should_draw, the game can decide when Coffee should trigger another draw. The default return value is true, which results in the same behaviour as before this change.

I haven't dug too deep into Coffee yet, but I believe timer.update() should still always run? At least anecdotally, for me, this change behaves as expected.

This allows game authors to implement FPS limits.
@JeanMertz
Copy link
Author

Further testing exposed that this change isn't behaving as expected. It appears the input state is not cleared if the draw call is skipped, which causes the interact method to receive duplicate input events.

I'm not sure where/how this happens, but this PR isn't merge-able as is.

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

Successfully merging this pull request may close these issues.

None yet

1 participant