Update to current devel/best practices.

This commit is contained in:
Leo Prikler 2021-01-05 19:09:34 +01:00 committed by nixo
parent 7cc7088036
commit 6691d6cc9e
1 changed files with 37 additions and 52 deletions

61
run.scm
View File

@ -2,11 +2,7 @@
(sdl2)
(sdl2 ttf)
(ice-9 match)
(tsukundere menu button)
(tsukundere game)
(tsukundere scene)
(tsukundere math)
(tsukundere script utils))
(tsukundere menu button))
(define (load)
(let* ((scene
@ -55,59 +51,48 @@
#:text-pos (s32vector 0 0)
#:anchor 'center
#:text-alignment '(center . center)
#:callback simple-button-callback)))
#:callback simple-button-callback))
(nixo (make-speaker "nixo")))
(init-script!
(lambda ()
(script
(begin
(background paper)
(say "nixo" "This is not an exam!")
(pause)
(say "nixo" "Chose one and press enter!")
(say "nixo"
(nixo "This is not an exam!"))
(nixo "Chose one and press enter!")
(nixo
(format #f "You choose: ~a\n"
(menu
'("Select me!" "Or me!" "No, select me!")
#:template radio-button)))
(pause)
(say "nixo" "Chose as many as you want!")
(say "nixo"
#:prototype radio-button)))
(nixo "Chose as many as you want!")
(nixo
(format #f "You selected: ~a\n"
(menu '(("A") ("B") ("C"))
#:template checkbox-button)))
(pause)
(say "nixo" "Click it!")
(say "nixo"
(format #f "You selected the element: ~a\n"
(menu
'((yep "Yes") (maybe "Maybe") (nope "No way")))))
(say "nixo"
#:prototype checkbox-button
#:seed '() #:pressed cons)))
(nixo "Click it!")
(nixo
(format #f "You selected the element number: ~a\n"
(menu
'("Yes" "Maybe" "No way"))))
(say "nixo"
(nixo "Click it again!")
(nixo
(format #f "You selected the element: ~a\n"
(menu
'(("Yes") ("Maybe") ("No way")))))
(say "nixo"
(nixo "Once more!")
(nixo
(format #f "You selected the element: ~a\n"
(menu
'((yep "Yes") (maybe "Maybe") (nope "No way")))))
(pause))
'(("Yes" . yep) ("Maybe" . maybe) ("No way" . nope)))))
*unspecified*))
scene)
(init-menu! 100 100 (s32vector 0 50) font textures
(s32vector 50 18)
#:colors colors
#:template simple-button)
(init-text! 10 300 280 font font)))
(init-menu! #s32(100 100) #s32(0 50) #f simple-button #:scene scene)
(init-text! 10 300 280 font font #:scene scene)))
(run-game
#:game-name ".tsukundere-example-buttons"
#:window-width 400
#:window-height 400
#:init! load)
(use-modules (ice-9 match))
(let ((option "OK"))
(match option
(selected selected)
((value selected) selected)
((selected . value) selected)))