summaryrefslogtreecommitdiff
path: root/scenes/intro.scm
blob: 640bdc8a422d5bd7540278ca341e6d73dcab23a9 (about) (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
56
57
58
59
60
61
62
63
64
;;; The Inevitable Game
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This program is free software: you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program.  If not, see
;;; <http://www.gnu.org/licenses/>.

(define-module (scenes intro)
  #:use-module (chickadee math rect)
  #:use-module (chickadee math vector)
  #:use-module (chickadee render font)
  #:use-module (engine assets)
  #:use-module (engine node)
  #:use-module (engine node-2d)
  #:use-module (engine scene)
  #:use-module (engine shell)
  #:use-module (scenes game)
  #:use-module (oop goops)
  #:export (<intro>))

(define-class <intro> (<scene>))

(define-asset intro-font
  (load-tile-font "assets/fonts/bubblemad_8x8.png" 8 8
                  " !\"©_%❤'()*+,-./0123456789:←<=>?@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"))


(define texts
  '("The void has been suspended for a while.\nYou exist for now."
    "Confusion gave way to a brief burst of consciousness.\nHere you are."
    "The haze clears and you can see that you are here now.\nYou did not ask for this."
    "You rise from deepest waters and take your first breath.\nYou wonder: will this last?"
    "History yields to the present.\nThe present crumbles underfoot,\nso you begin to run."
    "A leaf has turned.\nThe sunshine warms and blinds.\nThe leaf begins to dry."))

(set! *random-state* (random-state-from-platform))

(define-method (populate (intro <intro>))
  (list
   (make <label>
     #:name 'welcome
     #:font intro-font
     #:text (list-ref texts (random (length texts)))
     #:position (vec2 16.0 120.0))
   (make <label>
     #:name 'press-enter
     #:font intro-font
     #:text "press enter to start."
     #:position (vec2 72.0 80.0))))

(define-method (on-key-press (intro <intro>) key mods repeat?)
  (when (eq? key 'return)
    (switch-scene (root-node)
                  (game))))