Render controls using options menu
This commit is contained in:
@@ -64,10 +64,6 @@ data ScreenLayer
|
|||||||
, _scAvailableLines :: Int
|
, _scAvailableLines :: Int
|
||||||
, _scListDisplayParams :: ListDisplayParams
|
, _scListDisplayParams :: ListDisplayParams
|
||||||
}
|
}
|
||||||
| ColumnsScreen
|
|
||||||
{ _scTitle :: String
|
|
||||||
, _scColumns :: [(String, String)]
|
|
||||||
}
|
|
||||||
| InputScreen
|
| InputScreen
|
||||||
{ _scInput :: T.Text
|
{ _scInput :: T.Text
|
||||||
, _scFooter :: String
|
, _scFooter :: String
|
||||||
|
|||||||
+5
-1
@@ -99,6 +99,9 @@ trySeedFromClipboard u = do
|
|||||||
slTitleOptions :: String -> [MenuOption] -> Universe -> ScreenLayer
|
slTitleOptions :: String -> [MenuOption] -> Universe -> ScreenLayer
|
||||||
slTitleOptions title ops = initializeOptionMenu title ops (Just "BACK") (popScreen . writeConfig)
|
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 :: Universe -> ScreenLayer
|
||||||
optionMenu = initializeOptionMenu "OPTIONS" optionsOptions (Just "BACK") popScreen
|
optionMenu = initializeOptionMenu "OPTIONS" optionsOptions (Just "BACK") popScreen
|
||||||
|
|
||||||
@@ -211,7 +214,8 @@ unpause :: Universe -> Universe
|
|||||||
unpause w = resumeSound $ w & uvScreenLayers .~ []
|
unpause w = resumeSound $ w & uvScreenLayers .~ []
|
||||||
|
|
||||||
displayControls :: Universe -> ScreenLayer
|
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 :: [(String, String)]
|
||||||
listControls =
|
listControls =
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import Dodge.Render.List
|
|||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Dodge.Base.Window
|
import Dodge.Base.Window
|
||||||
import Dodge.Data.Universe
|
import Dodge.Data.Universe
|
||||||
import Padding
|
|
||||||
import Picture
|
import Picture
|
||||||
|
|
||||||
drawMenuScreen :: Configuration -> ScreenLayer -> Picture
|
drawMenuScreen :: Configuration -> ScreenLayer -> Picture
|
||||||
@@ -21,7 +20,6 @@ drawMenuScreen cfig screen = case screen of
|
|||||||
-- (WaitScreen sf _) -> drawOptions w (sf w) [] 0 ""
|
-- (WaitScreen sf _) -> drawOptions w (sf w) [] 0 ""
|
||||||
(InputScreen inputstr help) -> drawInputMenu cfig ('>' : T.unpack inputstr) help
|
(InputScreen inputstr help) -> drawInputMenu cfig ('>' : T.unpack inputstr) help
|
||||||
-- (DisplayScreen sd) -> sd w
|
-- (DisplayScreen sd) -> sd w
|
||||||
(ColumnsScreen titf pairs) -> drawTwoColumnsScreen cfig titf pairs
|
|
||||||
|
|
||||||
--menuScreen :: Configuration -> ScreenLayer -> Picture
|
--menuScreen :: Configuration -> ScreenLayer -> Picture
|
||||||
--menuScreen cfig screen = case screen of
|
--menuScreen cfig screen = case screen of
|
||||||
@@ -40,28 +38,6 @@ drawMenuScreen cfig screen = case screen of
|
|||||||
-- ys = [0,22..]
|
-- ys = [0,22..]
|
||||||
-- f y s = translate (10-hw) y . scale 0.15 0.15 $ text s
|
-- 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 ::
|
drawInputMenu ::
|
||||||
Configuration ->
|
Configuration ->
|
||||||
-- | Title
|
-- | Title
|
||||||
|
|||||||
Reference in New Issue
Block a user