flora-search-aurora/inventory.lisp
Jaidyn Ann eaa42ab2d8 Move 📋:RENDER-STRING* & 📋:RENDER-LINE to ✎
Also add new function, ✎:RENDER-STRING-VERBATIM
2023-06-30 13:52:50 -05:00

60 lines
2.3 KiB
Common Lisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;;; Copyright © 2023, Jaidyn Ann <jadedctrl@posteo.at>
;;;;
;;;; This program is free software: you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License as
;;;; published by the Free Software Foundation, either version 3 of
;;;; the License, or (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;;; FLORA-SEARCH-AURORA.INVENTORY
;;;; The menu for inventory selection/management.
(in-package :flora-search-aurora.inventory)
;;; ———————————————————————————————————
;;; Inventory loop logic
;;; ———————————————————————————————————
(defun inventory-state-update (map)
(if (and (listen)
(let ((input (getf (:read-gamefied-char-plist) :semantic)))
(or (eq input ':🆗)
(eq input ':))))
(values nil
(list :map map))
't))
;;; ———————————————————————————————————
;;; Inventory loop drawing
;;; ———————————————————————————————————
(defun inventory-state-draw (matrix items)
(:render-string matrix (format nil "~A" items) '(:x 0 :y 0)))
;;; ———————————————————————————————————
;;; Inventory loop
;;; ———————————————————————————————————
(defun inventory-state (matrix &key map)
"A state-function for use with STATE-LOOP."
(sleep .02)
(inventory-state-draw matrix (gethash :items map))
(inventory-state-update map))
(defun make-inventory-state (map)
"Return a state-function for inventory-listing, for use with STATE-LOOP."
(lambda (matrix &key (map map))
(apply #'🎒:inventory-state
(list matrix :map map))))