From bdbf1c6141ccf9345102770486e4a744785912c8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 3 Nov 2013 17:24:57 -0500 Subject: Remove stage local variables. Use an the scene initialization thunk to return the needed game state instead. --- 2d/scene.scm | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to '2d/scene.scm') 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 (%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)) -- cgit v1.2.3