diff options
author | David Thompson <dthompson2@worcester.edu> | 2013-11-03 17:24:57 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2013-11-03 17:24:57 -0500 |
commit | bdbf1c6141ccf9345102770486e4a744785912c8 (patch) | |
tree | e91f02ee0afff61d1b0f65f6ca9f580062e73b42 /2d/scene.scm | |
parent | cf4dc9bc6c33aee26e0a11cddeeaacbff8d1cc75 (diff) |
Remove stage local variables.
Use an the scene initialization thunk to return the needed game state
instead.
Diffstat (limited to '2d/scene.scm')
-rw-r--r-- | 2d/scene.scm | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/2d/scene.scm b/2d/scene.scm index 9560379..e67cdce 100644 --- a/2d/scene.scm +++ b/2d/scene.scm @@ -29,7 +29,12 @@ scene-enter scene-exit scene-draw - scene-update)) + scene-update + init-scene + enter-scene + exit-scene + draw-scene + update-scene)) (define-record-type <scene> (%make-scene init enter exit draw update) @@ -50,3 +55,24 @@ (update no-op)) "Create a new scene object. All callbacks default to a no-op." (%make-scene init enter exit draw update)) + +(define (init-scene scene) + "Return the value returned by the state constructor thunk for +SCENE." + ((scene-init scene))) + +(define (enter-scene scene state) + "Call enter callback for SCENE with STATE." + ((scene-enter scene) state)) + +(define (exit-scene scene state) + "Call the exit callback for SCENE with STATE." + ((scene-exit scene) state)) + +(define (draw-scene scene state) + "Call the draw callback for SCENE with STATE." + ((scene-draw scene) state)) + +(define (update-scene scene state) + "Call the update callback for SCENE with STATE." + ((scene-update scene) state)) |