diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-04-27 20:34:42 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-04-27 20:34:42 -0400 |
commit | 87fd3c3e5fafb8af0f4218308b24abb1a4ba7603 (patch) | |
tree | 6460d03809badf70d37b2b797ba0b378a3a099b7 /2d | |
parent | ff4799b1c8800d35d4a06230b0782ca6af7708d0 (diff) |
Ensure that interpolation alpha is clamped to the range [0, 1].
* 2d/game.scm (alpha): Clamp value to [0, 1].
Diffstat (limited to '2d')
-rw-r--r-- | 2d/game.scm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/2d/game.scm b/2d/game.scm index ac33881..09c3c11 100644 --- a/2d/game.scm +++ b/2d/game.scm @@ -27,6 +27,7 @@ #:use-module (gl) #:use-module (2d agenda) #:use-module (2d event) + #:use-module (2d math) #:use-module (2d signal) #:use-module (2d window) #:export (tick-interval @@ -76,7 +77,7 @@ is the unused accumulator time." (define (alpha lag) "Calculate interpolation factor in the range [0, 1] for the leftover frame time LAG." - (/ lag tick-interval)) + (clamp 0 1 (/ lag tick-interval))) (define (frame-sleep time) "Sleep for the remainder of the frame that started at TIME." |