diff --git a/src/UI/Game.hs b/src/UI/Game.hs index db6825c..bd8e7d9 100644 --- a/src/UI/Game.hs +++ b/src/UI/Game.hs @@ -61,7 +61,10 @@ app = App , appAttrMap = const theMap } -playGame :: Int -> Maybe String -> Bool -> IO Game +playGame :: Int -- ^ Starting level + -> Maybe String -- ^ Preview cell (Nothing == no preview) + -> Bool -- ^ Enable level progression + -> IO Game playGame lvl mp prog = do chan <- newBChan 10 tv <- newTVarIO lvl @@ -218,10 +221,10 @@ drawStats g = drawProgression :: Bool -> Widget Name drawProgression True = padLeftRight 1 $ str "Level Mode: " <+> - withAttr progressionAttr (str "ON") + withAttr progressionAttr (padLeft Max $ str "ON") drawProgression False = padLeftRight 1 $ str "Level Mode: " <+> - withAttr fixedAttr (str "OFF") + withAttr fixedAttr (padLeft Max $ str "Fixed") drawStat :: String -> Int -> Widget Name drawStat s n = padLeftRight 1 $ str s <+> padLeft Max (str $ show n) diff --git a/src/UI/PickLevel.hs b/src/UI/PickLevel.hs index e94039d..bcbce47 100644 --- a/src/UI/PickLevel.hs +++ b/src/UI/PickLevel.hs @@ -59,11 +59,14 @@ ui ps = else vBox [ str "Level Progression?" , str "" - , drawOption "YES" YesOption (selectedOption ps) - , drawOption "NO" NoOption (selectedOption ps) + , C.hCenter $ drawOption "YES" YesOption (selectedOption ps) + , C.hCenter $ drawOption "NO" NoOption (selectedOption ps) , str "" - , str "Use ↑↓ to select" - , str "Press Enter to continue" + , C.hCenter $ str "Use ↑↓ or j/k" + , C.hCenter $ str "to Select." + , str "" + , C.hCenter $ str "Press Enter" + , C.hCenter $ str "to Continue." ] ] @@ -91,6 +94,10 @@ handleEvent (VtyEvent (V.EvKey V.KUp [])) = whenNotPickingLevel $ modify $ \s -> s { selectedOption = YesOption } handleEvent (VtyEvent (V.EvKey V.KDown [])) = whenNotPickingLevel $ modify $ \s -> s { selectedOption = NoOption } +handleEvent (VtyEvent (V.EvKey (V.KChar 'j') [])) = + whenNotPickingLevel $ modify $ \s -> s { selectedOption = YesOption } +handleEvent (VtyEvent (V.EvKey (V.KChar 'k') [])) = + whenNotPickingLevel $ modify $ \s -> s { selectedOption = NoOption } handleEvent _ = pure () whenPickingLevel :: EventM () PickState () -> EventM () PickState ()