summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix.scm12
-rw-r--r--starling/kernel.scm2
-rw-r--r--starling/node-2d.scm6
-rw-r--r--starling/system.scm5
4 files changed, 14 insertions, 11 deletions
diff --git a/guix.scm b/guix.scm
index f6380cd..a52a052 100644
--- a/guix.scm
+++ b/guix.scm
@@ -90,7 +90,7 @@
(invoke "autoreconf" "-vfi")))))))))
(define guile-sdl2
- (let ((commit "ed821d76b70a1454285d415dfae7db9394c535f2"))
+ (let ((commit "5b965d180a1f536affd51ffc2b51d5e90fbc362d"))
(package
(name "guile-sdl2")
(version (string-append "0.5.0-1." (string-take commit 7)))
@@ -101,7 +101,7 @@
(commit commit)))
(sha256
(base32
- "1kh3hzf2lmpf773hbxzb0g7c0ghqydp9s969sigg58l8wbr85iyf"))))
+ "13x93kmpb9qp2zhp3ff3878xp2cj3z6gclmxqahyqj7fkxy1ffg5"))))
(build-system gnu-build-system)
(arguments
'(#:make-flags '("GUILE_AUTO_COMPILE=0")
@@ -118,9 +118,7 @@
(inputs
`(("guile" ,target-guile)
("sdl2" ,sdl2)
- ("sdl2-image" ,sdl2-image)
- ("sdl2-mixer" ,sdl2-mixer)
- ("sdl2-ttf" ,sdl2-ttf)))
+ ("sdl2-image" ,sdl2-image)))
(synopsis "Guile bindings for SDL2")
(description "Guile-sdl2 provides pure Guile Scheme bindings to the
SDL2 C shared library via the foreign function interface.")
@@ -128,7 +126,7 @@ SDL2 C shared library via the foreign function interface.")
(license license:lgpl3+))))
(define chickadee
- (let ((commit "5610b6a4a23855680d0d105b85f35a79d4015124"))
+ (let ((commit "8726cc42e3e7e5e6f34f7328898e35ed207bfb08"))
(package
(name "chickadee")
(version (string-append "0.5.0-1." (string-take commit 7)))
@@ -139,7 +137,7 @@ SDL2 C shared library via the foreign function interface.")
(commit commit)))
(sha256
(base32
- "0kki4lr5qbirikfa3axdn330iczzxczf67vmizl6xj7pkgk0kxgv"))))
+ "11l79c4365xlnkk53ma52pjzhphvq8xa9bd6qfxr1whklhi66isj"))))
(build-system gnu-build-system)
(arguments
'(#:make-flags '("GUILE_AUTO_COMPILE=0")
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))