fix missing accumulators, use new init-menu!

master
nixo 2021-01-12 12:12:24 +01:00
parent 5cbb11439d
commit ecb36f5d72
1 changed files with 13 additions and 2 deletions

15
run.scm
View File

@ -69,6 +69,8 @@
#:callback simple-button-callback))
(simple-menu
(make-menu '() #:pos #s32(100 100) #:spacing #s32(0 50)
#:accumulator
(cute menu-fold <> *unspecified* (lambda (val seed) val))
#:button-prototype simple-button))
(nixo (make-speaker "nixo")))
(init-script!
@ -84,6 +86,7 @@
(make-menu '(("Select me!")
("Or me!")
("No, select me!"))
#:accumulator (cute menu-fold <> '() cons)
#:prototype radio-menu))))
(nixo "Choose as many as you want!")
(nixo
@ -92,6 +95,7 @@
(make-menu '(("A" 0)
("B" 1)
("C" 2))
#:accumulator (cute menu-fold <> '() cons)
#:prototype checkbox-menu))))
(nixo "Choose as many as you want!")
(nixo
@ -100,6 +104,7 @@
(make-menu '(("A" 0 (pressed))
("B" 1 (selected))
("C" 2 (pressed)))
#:accumulator (cute menu-fold <> '() cons)
#:prototype checkbox-menu))))
(nixo "Click it!")
(nixo
@ -115,8 +120,14 @@
(menu (("Yes" yep) ("Maybe" maybe) ("No way" nope)))))
*unspecified*))
scene)
(scene-add-object! scene 'menu simple-menu) ; roughly equivalent to init-menu! below
;; (init-menu! #s32(100 100) #s32(0 50) simple-button #:scene scene)
(init-menu! simple-menu) ; equal to
;; (scene-add-object! scene 'menu simple-menu)
;; roughly equivalent to init-menu! below
;; (init-menu! #:pos #s32(100 100) #:spacing #s32(0 50)
;; #:prototype simple-button
;; #:accumulator (cute menu-fold <> *unspecified*
;; (lambda (val seed) val))
;; #:scene scene)
(init-text! 10 300 280 font font #:scene scene)))
(run-game