From bf6c2809034308ea56be5efa043ae6ccf120ce37 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 6 Jan 2020 13:14:59 -0800 Subject: [PATCH] game.loop: using timer's next-nanos, which is in the future. Also, use clamp to make sure tick offset is always [0,1]. --- extra/game/loop/loop.factor | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extra/game/loop/loop.factor b/extra/game/loop/loop.factor index c2612fd2b7..7047acf09d 100644 --- a/extra/game/loop/loop.factor +++ b/extra/game/loop/loop.factor @@ -1,9 +1,8 @@ ! Copyright (C) 2009 Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors timers alien.c-types calendar classes.struct -continuations destructors fry kernel math math.order memory -namespaces sequences system ui ui.gadgets.worlds vm -vocabs.loader arrays locals ; +USING: accessors calendar continuations destructors fry kernel +locals math math.order system timers ui ui.gadgets.worlds +vocabs.loader ; IN: game.loop TUPLE: game-loop @@ -36,8 +35,8 @@ TUPLE: game-loop-error-state error game-loop ; > next-nanos>> nano-count swap - ] - [ tick-interval-nanos>> ] bi /f 1.0 min ; + [ draw-timer>> next-nanos>> nano-count - ] + [ tick-interval-nanos>> ] bi /f 0.0 1.0 clamp ; GENERIC#: record-benchmarking 1 ( loop quot -- )