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:
parent
6eba471e24
commit
4ef19aa35a
21 changed files with 719 additions and 32 deletions
20
src/Xanthous/Command.hs
Normal file
20
src/Xanthous/Command.hs
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue