diff options
Diffstat (limited to '2d')
-rw-r--r-- | 2d/game-loop.scm | 5 | ||||
-rw-r--r-- | 2d/scene.scm | 4 | ||||
-rw-r--r-- | 2d/stage.scm | 8 |
3 files changed, 11 insertions, 6 deletions
diff --git a/2d/game-loop.scm b/2d/game-loop.scm index a6cd669..a14459e 100644 --- a/2d/game-loop.scm +++ b/2d/game-loop.scm @@ -130,10 +130,11 @@ time in milliseconds that has passed since the last game update." ;; By default, pressing the escape key will pop the current scene, and ;; closing the window will quit the game. -(default-events `((key-down . ,(lambda (key mod unicode) +(default-events `((key-down . ,(lambda (state key mod unicode) (when (eq? key 'escape) (pop-scene)))) - (quit . ,quit-game))) + (quit . ,(lambda (state) + (quit-game))))) (define handle-events (let ((e (SDL:make-event))) diff --git a/2d/scene.scm b/2d/scene.scm index 7415f80..cb053b7 100644 --- a/2d/scene.scm +++ b/2d/scene.scm @@ -89,5 +89,5 @@ SCENE." "Call the update callback for SCENE with STATE." ((scene-update scene) state)) -(define (scene-trigger scene event . args) - (apply observer-trigger (scene-observer scene) event args)) +(define (scene-trigger scene state event . args) + (apply observer-trigger (scene-observer scene) event state args)) diff --git a/2d/stage.scm b/2d/stage.scm index fee18a3..bf966ab 100644 --- a/2d/stage.scm +++ b/2d/stage.scm @@ -87,7 +87,11 @@ (define (stage-trigger stage event . args) (with-agenda (stage-agenda stage) - (apply scene-trigger (stage-scene stage) event args))) + (apply scene-trigger + (stage-scene stage) + (stage-state stage) + event + args))) ;;; ;;; Stage management @@ -116,7 +120,7 @@ present." (exit-stage prev-stage)) (set! stack (cdr stack)) (when (current-stage) - (enter-stage (car stack))))) + (enter-stage (current-stage))))) (define (replace-scene scene) "Replace the current stage with STAGE." |