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