Commit towards merge

This commit is contained in:
2022-03-20 17:18:12 +00:00
parent 6c3e335ded
commit 5e897c6a6c
10 changed files with 301 additions and 98 deletions
+13 -5
View File
@@ -11,9 +11,9 @@ import Padding
menuScreen :: Universe -> ScreenLayer -> Picture
menuScreen w screen = case screen of
OptionScreen {_scTitle = titf, _scOptions = mos}
-> drawOptions w (titf w) mos
(WaitScreen sf _) -> drawOptions w (sf w) []
(InputScreen s) -> drawOptions w ('>':s) []
-> drawOptions w (titf w) mos "Use keys to navigate the menu"
(WaitScreen sf _) -> drawOptions w (sf w) [] ""
(InputScreen s help) -> drawOptions w (s) [] help
(DisplayScreen sd ) -> sd w
(ColumnsScreen title pairs) -> drawTwoColumnsScreen (_config w) title pairs
@@ -47,10 +47,11 @@ drawOptions
:: Universe
-> String -- ^ Title
-> [MenuOption] -- ^ Options
-> String -- ^ Help Text
-> Picture
drawOptions u title ops = pictures $
drawOptions u title ops help = pictures $
[darkenBackground cfig
, drawTitle cfig title] ++
, drawTitle cfig title, drawHelpText cfig help red] ++
zipWith (\s vpos -> placeString (-hw + 50) vpos 0.2 s)
(map (menuOptionToString u) ops')
[hh-100,hh-150 ..]
@@ -73,6 +74,13 @@ drawTitle cfig = placeString (-hw + 30) (hh - 50) 0.4
hh = halfHeight cfig
hw = halfWidth cfig
drawHelpText :: Configuration -> String -> Color -> Picture
drawHelpText cfig col = placeString (-hw + 30) (-hh+10) 0.1 col
where
placeString x y sc t col = translate x y $ scale sc sc $ color col $ text t
hh = halfHeight cfig
hw = halfWidth cfig
menuOptionToString :: Universe -> MenuOption -> String
menuOptionToString w mo = theKeys ++ _moString mo w
where