coffee
coffee copied to clipboard
add `should_draw` to Game trait
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.
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.