summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-08-30 08:13:50 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-08-30 08:13:50 -0400
commita16af323c3df473306deac2e2c119466d46f748e (patch)
treebd42ce50129f39cc6a779798120237137c851b77
parent9b5bec99454995b40713e8af03b5853a609f2f25 (diff)
transition: Add sequence scene.
* starling/transition.scm (<sequence-scene>): New class.
-rw-r--r--starling/transition.scm31
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)