summaryrefslogtreecommitdiff
path: root/starling
diff options
context:
space:
mode:
Diffstat (limited to 'starling')
-rw-r--r--starling/kernel.scm2
-rw-r--r--starling/node-2d.scm6
-rw-r--r--starling/system.scm5
3 files changed, 9 insertions, 4 deletions
diff --git a/starling/kernel.scm b/starling/kernel.scm
index e302df1..52d7adb 100644
--- a/starling/kernel.scm
+++ b/starling/kernel.scm
@@ -331,7 +331,7 @@
(abort-game))
(define-method (fps kernel)
- (/ 1000.0 (avg-frame-time kernel)))
+ (/ 1.0 (avg-frame-time kernel)))
(define-method (boot-kernel (kernel <kernel>) thunk)
(sdl-init)
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 6d83da2..f7a40df 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -39,6 +39,7 @@
#:use-module (chickadee scripting)
#:use-module (ice-9 match)
#:use-module (oop goops)
+ #:use-module (rnrs base)
#:use-module (starling asset)
#:use-module (starling node)
#:use-module (starling scene)
@@ -499,8 +500,9 @@
(frame-duration (frame-duration anim))
(frames (frames anim))
(anim-duration (* frame-duration (vector-length frames)))
- (time (modulo (- (elapsed-time) (start-time sprite)) anim-duration))
- (frame (vector-ref frames (floor (/ time frame-duration)))))
+ (time (mod (- (elapsed-time) (start-time sprite)) anim-duration))
+ (frame (vector-ref frames (inexact->exact
+ (floor (/ time frame-duration))))))
(set! (index sprite) frame)
(next-method)))
diff --git a/starling/system.scm b/starling/system.scm
index 293d92d..a33647d 100644
--- a/starling/system.scm
+++ b/starling/system.scm
@@ -28,8 +28,11 @@
current-window
current-window-size))
+(define %time-freq (exact->inexact (sdl-performance-frequency)))
+
(define (elapsed-time)
- (sdl-ticks))
+ "Return the current value of the system timer in seconds."
+ (/ (sdl-performance-counter) %time-freq))
(define current-window (make-parameter #f))