summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-11-18 17:23:29 -0500
committerDavid Thompson <dthompson2@worcester.edu>2020-11-18 17:23:29 -0500
commit683c6ea4b7572f82dda5b9371afc94108eef31de (patch)
treef3cbd90c61b5df801b2a33d069551983c8bc784a
parentdafddcdb4c867f40b625c149345e4d3c3841f645 (diff)
examples: Replace calls to sdl-ticks with elapsed-time.
-rw-r--r--examples/particles.scm7
-rw-r--r--examples/sprite-batch.scm8
2 files changed, 7 insertions, 8 deletions
diff --git a/examples/particles.scm b/examples/particles.scm
index 5b42025..97cdb1d 100644
--- a/examples/particles.scm
+++ b/examples/particles.scm
@@ -8,8 +8,7 @@
(chickadee graphics sprite)
(chickadee graphics texture)
(chickadee scripting)
- (ice-9 format)
- ((sdl2) #:select (sdl-ticks)))
+ (ice-9 format))
(define window-width 800)
(define window-height 600)
@@ -17,7 +16,7 @@
(define emitter #f)
(define particle-texture #f)
(define sprite-texture #f)
-(define start-time (sdl-ticks))
+(define start-time 0.0)
(define avg-frame-time 0)
(define stats-text "")
@@ -58,7 +57,7 @@
(draw-particles particles)
(draw-sprite sprite-texture sprite-position)
(draw-text stats-text stats-text-pos)
- (let ((current-time (sdl-ticks)))
+ (let ((current-time (elapsed-time)))
(set! avg-frame-time
(+ (* (- current-time start-time) 0.1)
(* avg-frame-time 0.9)))
diff --git a/examples/sprite-batch.scm b/examples/sprite-batch.scm
index d4cccb5..30d8167 100644
--- a/examples/sprite-batch.scm
+++ b/examples/sprite-batch.scm
@@ -3,19 +3,19 @@
(chickadee math rect)
(chickadee math vector)
(chickadee graphics)
+ (chickadee graphics color)
(chickadee graphics font)
(chickadee graphics sprite)
(chickadee graphics texture)
(chickadee scripting)
(ice-9 format)
(ice-9 match)
- ((sdl2) #:select (sdl-ticks))
(srfi srfi-1)
(statprof))
(define texture #f)
(define batch #f)
-(define start-time (sdl-ticks))
+(define start-time 0.0)
(define avg-frame-time 16)
(define num-sprites 5000)
(define sprites
@@ -54,8 +54,8 @@
(sprite-batch-add* batch r matrix)))
sprites)
(draw-sprite-batch batch)
- (draw-text stats-text stats-text-pos)
- (let ((current-time (sdl-ticks)))
+ (draw-text stats-text stats-text-pos #:color black)
+ (let ((current-time (elapsed-time)))
(set! avg-frame-time
(+ (* (- current-time start-time) 0.1)
(* avg-frame-time 0.9)))