diff options
-rw-r--r-- | starling/kernel.scm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/starling/kernel.scm b/starling/kernel.scm index 25e92b6..078b6df 100644 --- a/starling/kernel.scm +++ b/starling/kernel.scm @@ -58,6 +58,7 @@ elapsed-time fps current-scene + previous-scene push-scene pop-scene replace-scene) @@ -282,10 +283,16 @@ (deactivate kernel) (close-window! (window kernel)))))) -(define-method (current-scene) +(define (current-scene) "Return the currently active scene" - (and (not (null? (scenes (current-kernel)))) - (car (scenes (current-kernel))))) + (match (scenes (current-kernel)) + (() #f) + ((scene . rest) scene))) + +(define (previous-scene) + (match (scenes (current-kernel)) + ((or () (_)) #f) + ((_ scene . rest) scene))) (define-method (push-scene (scene <scene>)) "Make SCENE the currently active scene and remember the previously |