summaryrefslogtreecommitdiff
path: root/apple-town-fair/common.scm
diff options
context:
space:
mode:
Diffstat (limited to 'apple-town-fair/common.scm')
-rw-r--r--apple-town-fair/common.scm30
1 files changed, 27 insertions, 3 deletions
diff --git a/apple-town-fair/common.scm b/apple-town-fair/common.scm
index 5fe5bb3..8407f2d 100644
--- a/apple-town-fair/common.scm
+++ b/apple-town-fair/common.scm
@@ -24,10 +24,34 @@
#:use-module (catbird scene)
#:use-module (catbird node)
#:use-module (catbird node-2d)
- #:export (steps
- full-screen-rectangle
+ #:use-module (ice-9 format)
+ #:export (day
+ day->string
fade-in
- fade-out))
+ fade-out
+ full-screen-rectangle
+ refresh
+ steps
+ time
+ time->string))
+
+(define-accessor day)
+(define-accessor time)
+(define-generic refresh)
+
+(define (day->string n)
+ (cond
+ ((= n 0) "Friday")
+ ((= n 1) "Saturday")
+ ((= n 2) "Sunday")
+ (else "??????")))
+
+(define (time->string n)
+ (let ((n* (modulo n 12)))
+ (format #f "~2,'0d:00 ~a"
+ (if (= n* 0) 12 n*)
+ (if (> n 11) "PM" "AM"))))
+
(define (steps n)
(* n (current-timestep)))