From a16af323c3df473306deac2e2c119466d46f748e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 30 Aug 2018 08:13:50 -0400 Subject: transition: Add sequence scene. * starling/transition.scm (): New class. --- starling/transition.scm | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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 ( + #:export ( + scenes + + scene-from scene-to duration )) + +;;; +;;; Sequence +;;; + +;; Not a transition like all the others, but still a form of +;; transitioning scenes. + +(define-class () + (scenes #:accessor scenes #:init-keyword #:scenes)) + +(define-method (on-enter (sequence )) + (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 () (scene-from #:getter scene-from #:init-keyword #:from) (scene-to #:getter scene-to #:init-keyword #:to) -- cgit v1.2.3