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