add world list
This commit is contained in:
parent
f9d9e332eb
commit
86a360bfaf
29
app/Main.hs
29
app/Main.hs
@ -159,11 +159,15 @@ world0 = World {
|
||||
main :: IO ()
|
||||
main =
|
||||
do args <- getArgs
|
||||
let name = case args of x:_ -> x; [] -> ""
|
||||
case args of
|
||||
x:_ | Just w <- Map.lookup x worldList ->
|
||||
bracket (mkVty =<< userConfig) shutdown \vty ->
|
||||
do
|
||||
loop vty (pure (pickWorld name))
|
||||
pure ()
|
||||
loop vty (pure w)
|
||||
_ ->
|
||||
do putStrLn "Usage: parabox <worldname>"
|
||||
putStrLn ""
|
||||
putStrLn "Available worlds:"
|
||||
mapM_ putStrLn (Map.keys worldList)
|
||||
|
||||
loop :: Vty -> NonEmpty World -> IO ()
|
||||
loop vty (world :| history) =
|
||||
@ -184,13 +188,16 @@ loop vty (world :| history) =
|
||||
_ -> loop vty (world :| history)
|
||||
_ -> loop vty (world :| history)
|
||||
|
||||
pickWorld :: String -> World
|
||||
pickWorld "world0" = world0
|
||||
pickWorld "small" = smallWorld
|
||||
pickWorld "center8" = center8
|
||||
pickWorld "center13" = center13
|
||||
pickWorld "clone11" = clone11
|
||||
pickWorld _ = transfer14
|
||||
|
||||
worldList :: Map.Map String World
|
||||
worldList = Map.fromList
|
||||
[ ("world0", world0)
|
||||
, ("small", smallWorld)
|
||||
, ("center8", center8)
|
||||
, ("center13", center13)
|
||||
, ("clone11", clone11)
|
||||
, ("transfer14", transfer14)
|
||||
]
|
||||
|
||||
smallWorld :: World
|
||||
smallWorld =
|
||||
|
Loading…
Reference in New Issue
Block a user