Permalink
Browse files

Add change-scene

  • Loading branch information...
Shinmera committed Mar 16, 2018
1 parent 0ae7161 commit f010c0e819a6d67c2a66ec7db6f6e0ab85569584
Showing with 15 additions and 12 deletions.
  1. +1 −12 controller.lisp
  2. +13 −0 main.lisp
  3. +1 −0 package.lisp
@@ -91,18 +91,7 @@
(retain-event ev))
(define-handler (controller reload-scene reload-scene 99) (ev)
(let* ((display (display controller))
(old (scene display)))
(stop old)
(restart-case
(let ((new (make-instance (type-of old))))
(setf (clock new) (clock old))
(setup-scene display new)
(transition old new)
(setf (scene display) new))
(abort ()
:report "Give up reloading the scene and continue with the old."
(start old)))))
(change-scene (display controller) (make-instance (type-of old) :clock (clock old))))
(defclass load-request (event)
((asset :initarg :asset)
@@ -49,6 +49,19 @@
(defmethod setup-scene :after ((main main) (scene scene))
(enter (controller main) scene))
(defmethod change-scene ((main main) (new scene))
(let ((old (scene main)))
(stop old)
(restart-case
(progn
(setup-scene main new)
(transition old new)
(setf (scene main) new))
(abort ()
:report "Give up changing the scene and continue with the old."
(start old)))
(values new old)))
(defmethod paint ((source main) (target main))
(paint (scene source) target)
(gl:bind-framebuffer :draw-framebuffer 0)
@@ -403,6 +403,7 @@
#:scene
#:controller
#:setup-scene
#:change-scene
#:launch)
;; mapping.lisp
(:export

0 comments on commit f010c0e

Please sign in to comment.