diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-06-04 09:25:06 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-06-04 09:25:06 -0400 |
commit | 45791c1360c98957ebe27655d59a2ae9db6cd709 (patch) | |
tree | 50661435d7d9f32a4a7398454d38c2c3ecc2170d /super-bloom/common.scm | |
parent | 255fbd76234e0411a9e95b7b80a28bf79c8dfff1 (diff) |
Giant code and assets drop.
Diffstat (limited to 'super-bloom/common.scm')
-rw-r--r-- | super-bloom/common.scm | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/super-bloom/common.scm b/super-bloom/common.scm new file mode 100644 index 0000000..08d4eae --- /dev/null +++ b/super-bloom/common.scm @@ -0,0 +1,69 @@ +;;; Copyright 2023 David Thompson +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. + +(define-module (super-bloom common) + #:use-module (catbird asset) + #:use-module (chickadee) + #:use-module (chickadee audio) + #:use-module (chickadee graphics text) + #:use-module (oop goops) + #:export (%default-width + %default-height + %game-width + %game-height + %game-width:float + %game-height:float + scope-datadir + monogram-font + explosion-sound + absorb-sound + watered-sound + spray-sound + random:float + steps + water)) + +(define %default-width 640) +(define %default-height 480) +(define %game-width 320) +(define %game-height 240) +(define %game-width:float (exact->inexact %game-width)) +(define %game-height:float (exact->inexact %game-height)) + +(define (scope-datadir file-name) + (let ((prefix (or (getenv "SUPERBLOOM_DATADIR") (getcwd)))) + (string-append prefix "/" file-name))) + +(define-asset (monogram-font (file (scope-datadir "assets/fonts/monogram_extended.ttf"))) + (load-font file 12 #:smooth? #f)) + +(define-asset (explosion-sound (file (scope-datadir "assets/audio/explosion.wav"))) + (load-audio file)) + +(define-asset (absorb-sound (file (scope-datadir "assets/audio/absorb.wav"))) + (load-audio file)) + +(define-asset (watered-sound (file (scope-datadir "assets/audio/watered.wav"))) + (load-audio file)) + +(define-asset (spray-sound (file (scope-datadir "assets/audio/spray.wav"))) + (load-audio file)) + +(define (random:float n) + (* (random:uniform) n)) + +(define (steps n) + (* n (current-timestep))) + +(define-accessor water) |