From b8d3919f09060df2b45700f13a4108c82164b80f Mon Sep 17 00:00:00 2001 From: Alula <julekonopinska@gmail.com> Date: Fri, 30 Oct 2020 00:04:27 +0100 Subject: [PATCH] make the fps timer count frames, not events. why i'm a such idiot? --- src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index af1f747..839e686 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -314,7 +314,6 @@ pub fn init() -> GameResult { event_loop.run(move |event, target, flow| { if let Some(ctx) = &mut context { - ctx.timer_context.tick(); ctx.process_event(&event); if let Some(game) = &mut game { @@ -394,6 +393,7 @@ pub fn init() -> GameResult { Event::RedrawRequested(win) => { if let (Some(ctx), Some(game)) = (&mut context, &mut game) { if win == window(ctx).window().id() { + ctx.timer_context.tick(); game.draw(ctx).unwrap(); } } @@ -403,8 +403,10 @@ pub fn init() -> GameResult { game.update(ctx).unwrap(); #[cfg(target_os = "android")] - game.draw(ctx).unwrap(); // redraw request is unimplemented on shitdroid - + { + ctx.timer_context.tick(); + game.draw(ctx).unwrap(); // redraw request is unimplemented on shitdroid + } window(ctx).window().request_redraw(); if game.state.shutdown {