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

89
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 ()
(background paper) (script
(say "nixo" "This is not an exam!") (begin
(pause) (background paper)
(say "nixo" "Chose one and press enter!") (nixo "This is not an exam!"))
(say "nixo" (nixo "Chose one and press enter!")
(format #f "You choose: ~a\n" (nixo
(menu (format #f "You choose: ~a\n"
'("Select me!" "Or me!" "No, select me!") (menu
#:template radio-button))) '("Select me!" "Or me!" "No, select me!")
(pause) #:prototype radio-button)))
(say "nixo" "Chose as many as you want!") (nixo "Chose as many as you want!")
(say "nixo" (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" (format #f "You selected the element number: ~a\n"
(menu (menu
'((yep "Yes") (maybe "Maybe") (nope "No way"))))) '("Yes" "Maybe" "No way"))))
(say "nixo" (nixo "Click it again!")
(format #f "You selected the element number: ~a\n" (nixo
(menu (format #f "You selected the element: ~a\n"
'("Yes" "Maybe" "No way")))) (menu
(say "nixo" '(("Yes") ("Maybe") ("No way")))))
(format #f "You selected the element: ~a\n" (nixo "Once more!")
(menu (nixo
'(("Yes") ("Maybe") ("No way"))))) (format #f "You selected the element: ~a\n"
(say "nixo" (menu
(format #f "You selected the element: ~a\n" '(("Yes" . yep) ("Maybe" . maybe) ("No way" . nope)))))
(menu *unspecified*))
'((yep "Yes") (maybe "Maybe") (nope "No way")))))
(pause))
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)))