summaryrefslogtreecommitdiff
path: root/bonnie-bee/splash.scm
blob: 98239d6e7567963753a8b36171a5460c41d22c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
(define-module (bonnie-bee splash)
  #:use-module (bonnie-bee assets)
  #:use-module (bonnie-bee common)
  #:use-module (bonnie-bee game)
  #:use-module (chickadee graphics color)
  #: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)
  #:export (launch-game))

(define-class <splash> (<scene-2d>))

(define %text-color (rgb #xfee761))

(define-method (on-boot (splash <splash>))
  (set-cameras! splash)
  (attach-to splash
             (make <sprite>
               #:texture darkness-image)
             (make <label>
               #:rank 1
               #:position (vec2 (/ %game-width 2.0) 120.0)
               #: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) 100.0)
               #: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 (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>))))