diff options
author | David Thompson <dthompson@vistahigherlearning.com> | 2022-10-12 06:48:14 -0400 |
---|---|---|
committer | David Thompson <dthompson@vistahigherlearning.com> | 2022-10-27 13:22:50 -0400 |
commit | e287a11c4387382277c31735504fc762c33b4cee (patch) | |
tree | b262dc8de64db21a7d2cb2c980f2be39805d6a34 /bonnie-bee/splash.scm | |
parent | f713890a773a7d6ff666277592eec72f2328a5b6 (diff) |
Switch to Catbird engine.
Diffstat (limited to 'bonnie-bee/splash.scm')
-rw-r--r-- | bonnie-bee/splash.scm | 105 |
1 files changed, 59 insertions, 46 deletions
diff --git a/bonnie-bee/splash.scm b/bonnie-bee/splash.scm index 7059f91..09fcb47 100644 --- a/bonnie-bee/splash.scm +++ b/bonnie-bee/splash.scm @@ -6,56 +6,69 @@ #:use-module (chickadee math vector) #:use-module (chickadee scripting) #:use-module (oop goops) - #:use-module (starling kernel) - #:use-module (starling node) - #:use-module (starling node-2d) - #:use-module (starling scene) + #:use-module (catbird) + #:use-module (catbird camera) + #:use-module (catbird kernel) + #:use-module (catbird mode) + #:use-module (catbird node) + #:use-module (catbird node-2d) + #:use-module (catbird region) + #:use-module (catbird scene) #:export (launch-game)) -(define-class <splash> (<scene-2d>)) +(define-class <splash-mode> (<major-mode>)) (define %text-color (rgb #x181425)) -(define-method (on-boot (splash <splash>)) - (set-cameras! splash) - (attach-to splash - (make <sprite> - #:texture lightness-image) - (make <sprite> - #:texture chickadee-image - #:position (vec2 (/ %game-width 2.0) - (/ %game-height 2.0)) - #:origin (vec2 8.0 8.0) - #:scale (vec2 4.0 4.0)) - (make <label> - #:rank 1 - #:position (vec2 (/ %game-width 2.0) 70.5) - #:font monogram-font - #:color %text-color - #:align 'center - #:vertical-align 'center - #:text "Made with Chickadee") - (make <label> - #:rank 1 - #:position (vec2 (/ %game-width 2.0) 50.5) - #:font monogram-font - #:color %text-color - #:align 'center - #:vertical-align 'center - #:text "https://dthompson.us/projects/chickadee.html"))) - -(define-method (on-enter (splash <splash>)) - (run-script splash - (unless (getenv "SKIP_SPLASH") - (fade-in splash 1.0) - (sleep 1.0) - (fade-out splash 1.0)) - (replace-scene (current-kernel) (make <game>)))) +(define-method (on-enter (mode <splash-mode>)) + (let ((scene (parent mode))) + (attach-to scene + (make <sprite> + #:texture lightness-image) + (make <sprite> + #:texture chickadee-image + #:position (vec2 (/ %game-width 2.0) + (/ %game-height 2.0)) + #:origin (vec2 8.0 8.0) + #:scale (vec2 4.0 4.0)) + (make <label> + #:rank 1 + #:position (vec2 (/ %game-width 2.0) 70.5) + #:font monogram-font + #:color %text-color + #:align 'center + #:vertical-align 'center + #:text "Made with Chickadee") + (make <label> + #:rank 1 + #:position (vec2 (/ %game-width 2.0) 50.5) + #:font monogram-font + #:color %text-color + #:align 'center + #:vertical-align 'center + #:text "https://dthompson.us/projects/chickadee.html")) + (run-script scene + (unless (getenv "SKIP_SPLASH") + (fade-in scene 1.0) + (sleep 1.0) + (fade-out scene 1.0)) + (let ((new-scene (make <scene>)) + (region (car (all-regions)))) + (replace-scene region (make-game-scene)))))) (define (launch-game) - (boot-kernel (make <kernel> - #:window-config (make <window-config> - #:title "Bonnie Bee and the Pesticidal Tendencies - Autumn Lisp Game Jam 2021" - #:width %window-width - #:height %window-height)) - (lambda () (make <splash>)))) + (set! *random-state* (random-state-from-platform)) + (run-catbird + (lambda () + (let ((region (create-full-region)) + (scene (make <scene>))) + (take-controller-focus 0 region) + (replace-scene region scene) + (replace-major-mode scene (make <splash-mode>)) + (set! (camera region) + (make <camera-2d> + #:width %game-width + #:height %game-height)))) + #:width %window-width + #:height %window-height + #:title "Bonnie Bee and the Pesticidal Tendencies")) |