From c7c0ed6d654cf9fd65d0739f50d38dc8bf8fb828 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Thu, 22 Jun 2023 11:31:49 -0500 Subject: [PATCH] =?UTF-8?q?Menu=20state-function=20creator:=20#'?= =?UTF-8?q?=F0=9F=93=8B:make-menu-state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flora-search-aurora.lisp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/flora-search-aurora.lisp b/flora-search-aurora.lisp index ef02856..1b0958a 100644 --- a/flora-search-aurora.lisp +++ b/flora-search-aurora.lisp @@ -88,31 +88,6 @@ overheat, or something Β―\_(ツ)_/Β―" state-result)))))) -(defun make-main-menu-state () - "Return a state-function for the game’s main menu, for use with STATE-LOOP." - (let ((main-menu - `(((LABEL . "PLAY") - (SELECTION . 100) (SELECTED . T) - (FUNCTION . ,#'make-main-overworld-state)) - ((LABEL . "SUBMENU") - (FUNCTION . ,#'make-options-menu-state)) - ((LABEL . "QUIT") (RETURN . NIL))))) - (lambda (matrix) - (πŸ“‹:menu-state matrix main-menu)))) - - -(defun make-options-menu-state () - "Return a state-function for the options menu, for use with STATE-LOOP." - (let ((options-menu - `(((LABEL . "IDK") - (SELECTION . 100) (SELECTED . T) - (FUNCTION . ,(lambda () (print "Β―\_(ツ)_/Β―")))) - ((LABEL . "GO BACK") - (RETURN . ,NIL))))) - (lambda (matrix) - (πŸ“‹:menu-state matrix options-menu)))) - - (defun make-main-overworld-state () "Return a state-function for the game’s overworld (the majority of the game), for use with STATE-LOOP." @@ -123,13 +98,23 @@ with STATE-LOOP." args)))) +(defparameter *submenu* `(((label . "IDK") (selection . 100) (selected t)) + ((label . "GO BACK") (return . nil)))) + + +(defparameter *main-menu* `(((label . "PLAY") (selection . 100) (selected . t) + (return . ,(make-main-overworld-state))) + ((label . "SUBMENU") (return . ,(πŸ“‹:make-menu-state *submenu*))) + ((label . "QUIT") (return . nil)))) + + (defun main () "A pathetic fascimile of a main loop. What does it do? WHAST DOES TI DODOO?" (cl-charms:with-curses () (cl-charms:enable-raw-input :interpret-control-characters 't) (✎:hide-cursor) (✎:clear-screen) - (state-loop (list (make-main-menu-state))))) + (state-loop (list (πŸ“‹:make-menu-state *main-menu*))))) (main) ;; β€” Knock-knock