Create the scaffodling for an inventory menu
All it does right now is print your raw list of items. That’s OK for now! =w=
This commit is contained in:
parent
6c8f84afe8
commit
06e875b271
|
@ -7,6 +7,7 @@
|
|||
(:file "display")
|
||||
(:file "input")
|
||||
(:file "ui")
|
||||
(:file "inventory")
|
||||
(:file "overworld.util")
|
||||
(:file "overworld")
|
||||
(:file "dialogue")
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
|
||||
;;;; 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.
|
||||
|
||||
(defpackage :flora-search-aurora.inventory
|
||||
(:nicknames :fsa.inv :inventory :🎒)
|
||||
(:use :cl)
|
||||
(:export #:inventory-state #:make-inventory-state))
|
||||
|
||||
(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))))
|
||||
|
|
@ -224,12 +224,12 @@ Returns parameters to be used in the next invocation of OVERWORLD-STATE."
|
|||
(if interaction
|
||||
(apply (string->symbol interaction) (list map interactee-id))
|
||||
(list :map map))))
|
||||
;; The pause-menu…
|
||||
;; ((plist = input '(:modifier nil :char #\Esc)))
|
||||
('⌨:❎
|
||||
(🎒:make-inventory-state map))
|
||||
;; Simple up-down-left-right movements
|
||||
('⌨:→
|
||||
(move-player map :Δx 1))
|
||||
('⌨:→
|
||||
('⌨:←
|
||||
(move-player map :Δx -1))
|
||||
('⌨:↑
|
||||
(move-player map :Δy -1))
|
||||
|
|
Ŝarĝante…
Reference in New Issue