Render controls using options menu

This commit is contained in:
2022-12-24 13:35:29 +00:00
parent 80d319b38e
commit a3162e8f9c
3 changed files with 5 additions and 29 deletions
-4
View File
@@ -64,10 +64,6 @@ data ScreenLayer
, _scAvailableLines :: Int
, _scListDisplayParams :: ListDisplayParams
}
| ColumnsScreen
{ _scTitle :: String
, _scColumns :: [(String, String)]
}
| InputScreen
{ _scInput :: T.Text
, _scFooter :: String
+5 -1
View File
@@ -99,6 +99,9 @@ trySeedFromClipboard u = do
slTitleOptions :: String -> [MenuOption] -> Universe -> ScreenLayer
slTitleOptions title ops = initializeOptionMenu title ops (Just "BACK") (popScreen . writeConfig)
optionsNoWrite :: String -> [MenuOption] -> Universe -> ScreenLayer
optionsNoWrite title ops = initializeOptionMenu title ops (Just "BACK") popScreen
optionMenu :: Universe -> ScreenLayer
optionMenu = initializeOptionMenu "OPTIONS" optionsOptions (Just "BACK") popScreen
@@ -211,7 +214,8 @@ unpause :: Universe -> Universe
unpause w = resumeSound $ w & uvScreenLayers .~ []
displayControls :: Universe -> ScreenLayer
displayControls = const $ ColumnsScreen "CONTROLS" listControls
--displayControls = const $ ColumnsScreen "CONTROLS" listControls
displayControls = optionsNoWrite "CONTROLS" $ map (Toggle id . const . uncurry MODStringOption) listControls
listControls :: [(String, String)]
listControls =
-24
View File
@@ -11,7 +11,6 @@ import Dodge.Render.List
import qualified Data.Text as T
import Dodge.Base.Window
import Dodge.Data.Universe
import Padding
import Picture
drawMenuScreen :: Configuration -> ScreenLayer -> Picture
@@ -21,7 +20,6 @@ drawMenuScreen cfig screen = case screen of
-- (WaitScreen sf _) -> drawOptions w (sf w) [] 0 ""
(InputScreen inputstr help) -> drawInputMenu cfig ('>' : T.unpack inputstr) help
-- (DisplayScreen sd) -> sd w
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen cfig titf pairs
--menuScreen :: Configuration -> ScreenLayer -> Picture
--menuScreen cfig screen = case screen of
@@ -40,28 +38,6 @@ drawMenuScreen cfig screen = case screen of
-- ys = [0,22..]
-- f y s = translate (10-hw) y . scale 0.15 0.15 $ text s
drawTwoColumnsScreen :: Configuration -> String -> [(String, String)] -> Picture
drawTwoColumnsScreen cfig title lps =
pictures
[ darkenBackground cfig
, drawTitle cfig title
, drawTwoColumns cfig lps
]
drawTwoColumns :: Configuration -> [(String, String)] -> Picture
drawTwoColumns cfig lps = listPicturesAtScaleOff 30 2 50 50 cfig 0 $ map f lps
where
f (s1, s2) = color white $ text $ rightPad ln '.' s1 ++ s2
ln = maximum (map (length . fst) lps) + 3
--drawTwoColumns' :: Configuration -> [(String, String)] -> Picture
--drawTwoColumns' cfig lps = pictures $ zipWith f [hh -100, hh -130 ..] lps
-- where
-- f y (s1, s2) = placeString (50 - hw) y 0.15 $ rightPad ln '.' s1 ++ s2
-- hh = halfHeight cfig
-- hw = halfWidth cfig
-- ln = maximum (map (length . fst) lps) + 3
drawInputMenu ::
Configuration ->
-- | Title