about summary refs log tree commit diff
path: root/src/Xanthous/App.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-12-01T03·43-0500
committerGriffin Smith <root@gws.fyi>2019-12-01T03·43-0500
commit65b1352ef2e463393d0504c32b73bdcf7c99491a (patch)
tree9bbd627db18babdeff099d7a248103e2148a93f8 /src/Xanthous/App.hs
parent71b628c604556bc2d829f12980db99c9a526ec84 (diff)
Add a very basic inventory panel
Add a very basic inventory panel to the game opened by pressing `i`,
which displays the contents of the player's inventory in a basic list.
Diffstat (limited to 'src/Xanthous/App.hs')
-rw-r--r--src/Xanthous/App.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Xanthous/App.hs b/src/Xanthous/App.hs
index df76eadc3bbc..9d606bbef344 100644
--- a/src/Xanthous/App.hs
+++ b/src/Xanthous/App.hs
@@ -34,7 +34,7 @@ import           Xanthous.Game.State
 import           Xanthous.Game.Draw (drawGame)
 import           Xanthous.Game.Prompt
 import           Xanthous.Monad
-import           Xanthous.Resource (Name)
+import           Xanthous.Resource (Name, Panel(..))
 import qualified Xanthous.Messages as Messages
 import           Xanthous.Util.Inflection (toSentence)
 --------------------------------------------------------------------------------
@@ -231,6 +231,8 @@ handleCommand Read = do
             in readAndContinue msgs
   continue
 
+handleCommand Inventory = showPanel InventoryPanel >> continue
+
 handleCommand Save = do
   -- TODO default save locations / config file?
   prompt_ @'StringPrompt ["save", "location"] Cancellable
@@ -439,4 +441,9 @@ entityMenu_ = mkMenuItems @[_] . map entityMenuItem
 -- entityMenu :: Entity entity => [entity] -> Map Char (MenuOption entity)
 -- entityMenu = map (map runIdentity) . entityMenu_ . fmap Identity
 
---------------------------------------------------------------------------------
+showPanel :: Panel -> AppM ()
+showPanel panel = do
+  activePanel ?= panel
+  prompt_ @'Continue ["generic", "continue"] Uncancellable
+    . const
+    $ activePanel .= Nothing