Add entities, and allow walking around

Add support for entities via a port of the EntityMap type, and implement
command support starting at basic hjkl.
This commit is contained in:
Griffin Smith 2019-08-31 13:17:27 -04:00
parent 6eba471e24
commit 4ef19aa35a
21 changed files with 719 additions and 32 deletions

20
src/Xanthous/Command.hs Normal file
View file

@ -0,0 +1,20 @@
module Xanthous.Command where
import Graphics.Vty.Input (Key(..), Modifier(..))
import Xanthous.Prelude hiding (Left, Right, Down)
import Xanthous.Data (Direction(..))
data Command
= Quit
| Move Direction
| PickUp
| PreviousMessage
commandFromKey :: Key -> [Modifier] -> Maybe Command
commandFromKey (KChar 'q') [] = Just Quit
commandFromKey (KChar 'h') [] = Just $ Move Left
commandFromKey (KChar 'j') [] = Just $ Move Down
commandFromKey (KChar 'k') [] = Just $ Move Up
commandFromKey (KChar 'l') [] = Just $ Move Right
commandFromKey _ _ = Nothing