Added centering credit

This commit is contained in:
Amy Grinn 2025-01-15 09:16:13 -05:00
parent 8842e01207
commit 4f5676d3a5
No known key found for this signature in database
GPG key ID: 6B558BED1DCF3192

View file

@ -462,7 +462,19 @@
(make-credit-text text)
(make-credit-text (make-string (string-length text) #\-))))
(define credits
(define (make-credit-centering total-lines credit)
(make-credit
#:lines total-lines
#:draw
(lambda (y)
(let* ((progress (/ (- credits-start y) (+ game-height
(* (line-height) total-lines))))
(offset (* total-lines (line-height)
(/ (1+ (- (cos (* progress 3.14)))) 2))))
((credit-draw credit) (+ y offset))))
#:update (lambda () ((credit-update credit)))
#:on-enter (lambda () ((credit-on-enter credit)))
#:on-leave (lambda () ((credit-on-leave credit)))))
(define (make-credits)
(vector (make-credit-group
@ -495,8 +507,8 @@
(make-credit-group
(make-credit-underline "Other")
(make-credit-text "monogram font by datagoblin"))
(make-credit #:lines 4)
(make-credit-text "Thank you for playing!")))
(make-credit-centering
10 (make-credit-text "Thank you for playing!"))))
(define-record-type <credits>
(make-credits-state credits top first-visible-index next-visible-index)