Added centering credit
This commit is contained in:
parent
8842e01207
commit
4f5676d3a5
1 changed files with 15 additions and 3 deletions
18
game.scm
18
game.scm
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue