diff options
-rw-r--r-- | starling/transition.scm | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/starling/transition.scm b/starling/transition.scm index 0d70e2f..f673d9c 100644 --- a/starling/transition.scm +++ b/starling/transition.scm @@ -24,18 +24,47 @@ #:use-module (chickadee math rect) #:use-module (chickadee render color) #:use-module (chickadee scripting) + #:use-module (ice-9 match) #:use-module (oop goops) #:use-module (starling kernel) #:use-module (starling node) #:use-module (starling node-2d) #:use-module (starling scene) - #:export (<transition> + #:export (<sequence-scene> + scenes + + <transition> scene-from scene-to duration <fade-transition>)) + +;;; +;;; Sequence +;;; + +;; Not a transition like all the others, but still a form of +;; transitioning scenes. + +(define-class <sequence-scene> (<scene>) + (scenes #:accessor scenes #:init-keyword #:scenes)) + +(define-method (on-enter (sequence <sequence-scene>)) + (match (scenes sequence) + ((scene) + ;; If we've reached the last scene, we're done! + (replace-scene scene)) + ((scene . rest) + (set! (scenes sequence) rest) + (push-scene scene)))) + + +;;; +;;; Transitions +;;; + (define-class <transition> (<scene>) (scene-from #:getter scene-from #:init-keyword #:from) (scene-to #:getter scene-to #:init-keyword #:to) |