summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am4
-rw-r--r--starling/kernel.scm10
-rw-r--r--starling/node-2d.scm5
3 files changed, 13 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index 108173a..7a12ef2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -41,9 +41,9 @@ SOURCES = \
starling/inotify.scm \
starling/asset.scm \
starling/node.scm \
- starling/node-2d.scm \
starling/repl.scm \
- starling/kernel.scm
+ starling/kernel.scm \
+ starling/node-2d.scm
EXTRA_DIST += \
COPYING
diff --git a/starling/kernel.scm b/starling/kernel.scm
index 9c23448..04fb4cd 100644
--- a/starling/kernel.scm
+++ b/starling/kernel.scm
@@ -52,18 +52,21 @@
on-controller-press
on-controller-release
on-controller-move
+
<window-config>
width
height
title
fullscreen?
+
<kernel>
window-config
update-hz
window
gl-context
current-kernel
- boot-kernel)
+ boot-kernel
+ elapsed-time)
#:re-export (abort-game))
;; Input event handler methods
@@ -262,6 +265,9 @@
(set-window-title! (window kernel) title))
(apply throw key args)))
+(define (elapsed-time)
+ (sdl-ticks))
+
(define (boot-kernel kernel first-node)
(sdl-init)
;; This will throw an error if any audio subsystem is unavailable,
@@ -298,7 +304,7 @@
#:render (lambda (alpha) (render* kernel alpha))
#:error (lambda (stack key args)
(on-error kernel stack key args))
- #:time sdl-ticks
+ #:time elapsed-time
#:update-hz (update-hz kernel))))
(lambda ()
(deactivate kernel)
diff --git a/starling/node-2d.scm b/starling/node-2d.scm
index 39a5aa7..7867fe1 100644
--- a/starling/node-2d.scm
+++ b/starling/node-2d.scm
@@ -35,6 +35,7 @@
#:use-module (chickadee scripting)
#:use-module (oop goops)
#:use-module (starling asset)
+ #:use-module (starling kernel)
#:use-module (starling node)
#:export (<camera-2d>
target
@@ -368,7 +369,7 @@
(let* ((anim (assq-ref (animations sprite) (current-animation sprite)))
(frame-duration (frame-duration sprite))
(anim-duration (* frame-duration (vector-length anim)))
- (time (modulo (- (agenda-time) (start-time sprite)) anim-duration))
+ (time (modulo (- (elapsed-time) (start-time sprite)) anim-duration))
(frame (vector-ref anim (floor (/ time frame-duration))))
(texture-region (texture-atlas-ref (asset-ref (atlas sprite)) frame)))
(set! (texture sprite) texture-region)
@@ -376,7 +377,7 @@
(define-method (change-animation (sprite <animated-sprite>) name)
(set! (current-animation sprite) name)
- (set! (start-time sprite) (with-agenda (agenda sprite) (agenda-time))))
+ (set! (start-time sprite) (elapsed-time)))
;;;