summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-09-04 22:59:20 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-09-06 00:09:29 -0400
commit0ae7fe04d628cc7fc98e785d3808c8571ef202fb (patch)
tree6a93c93ae7ea6053e43b0bec6a3603c4d211f57b
parent59b767dcd56486da3a964888920b5bb30415e0de (diff)
Create copies of the default events alist for safety.
-rw-r--r--2d/game.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/2d/game.scm b/2d/game.scm
index 4a1d88f..c7fa02f 100644
--- a/2d/game.scm
+++ b/2d/game.scm
@@ -34,15 +34,18 @@
;; When no event callbacks are specified for a scene, these
;; (hopefully) convenient defaults will be used.
-(define default-scene-events
+(define %default-scene-events
`((quit . ,(lambda (state) (quit-game-loop!)))
(key-down . ,(lambda (state key mode unicode)
(when (any-equal? key 'escape 'q)
(quit-game-loop!))))))
+(define (default-scene-events)
+ (copy-tree %default-scene-events))
+
(define* (make-scene #:optional #:key
(title "A Guile-2D Scene")
- (events default-scene-events)
+ (events (default-scene-events))
(update (lambda (s) #f))
(draw (lambda (s) #f))
(state #f))