Simplify main function
This commit is contained in:
parent
21cfca30d2
commit
7fe6d2a24d
|
@ -47,25 +47,32 @@
|
||||||
matrix))))
|
matrix))))
|
||||||
|
|
||||||
|
|
||||||
(defun main ()
|
(defun make-main-menu-loop ()
|
||||||
"A pathetic fascimile of a main loop. Look, I'm still tinkering!"
|
(let ((main-menu
|
||||||
(let* ((options-menu
|
|
||||||
`(((LABEL . "IDK") (SELECTION . 100) (SELECTED . T)
|
|
||||||
(FUNCTION . ,(lambda () (print "¯\_(ツ)_/¯"))))
|
|
||||||
((LABEL . "GO BACK") (FUNCTION . ,(lambda () nil)))))
|
|
||||||
(main-menu
|
|
||||||
`(((LABEL . "CRY OUT") (SELECTED . T) (FUNCTION . ,(lambda () (print "AAAAAA"))))
|
`(((LABEL . "CRY OUT") (SELECTED . T) (FUNCTION . ,(lambda () (print "AAAAAA"))))
|
||||||
((LABEL . "RUN AWAY") (FUNCTION . ,(lambda () nil)))
|
((LABEL . "RUN AWAY") (FUNCTION . ,(lambda () nil)))
|
||||||
((LABEL . "SUBMENU")
|
((LABEL . "SUBMENU")
|
||||||
(SELECTION . -100)
|
(SELECTION . -100)
|
||||||
(FUNCTION
|
(FUNCTION . ,(make-options-menu-loop))))))
|
||||||
. ,(lambda ()
|
|
||||||
(lambda (matrix)
|
(lambda (matrix)
|
||||||
(menu-loop matrix options-menu))))))))
|
(menu-loop matrix main-menu))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun make-options-menu-loop ()
|
||||||
|
(let ((options-menu
|
||||||
|
`(((LABEL . "IDK") (SELECTION . 100) (SELECTED . T)
|
||||||
|
(FUNCTION . ,(lambda () (print "¯\_(ツ)_/¯"))))
|
||||||
|
((LABEL . "GO BACK") (FUNCTION . ,(lambda () nil))))))
|
||||||
|
(lambda (matrix)
|
||||||
|
(menu-loop matrix options-menu))))
|
||||||
|
|
||||||
|
|
||||||
|
(defun main ()
|
||||||
|
"A pathetic fascimile of a main loop. Look, I'm still tinkering!"
|
||||||
(cl-charms:with-curses ()
|
(cl-charms:with-curses ()
|
||||||
(cl-charms:enable-raw-input :interpret-control-characters 't)
|
(cl-charms:enable-raw-input :interpret-control-characters 't)
|
||||||
(clear-screen)
|
(clear-screen)
|
||||||
(state-loop (list (lambda (matrix) (menu-loop matrix main-menu)))))))
|
(state-loop (list (make-main-menu-loop)))))
|
||||||
|
|
||||||
|
|
||||||
;; (print-screen-matrix
|
;; (print-screen-matrix
|
||||||
|
|
Ŝarĝante…
Reference in New Issue