Allow for events to do io
This commit is contained in:
@@ -16,7 +16,7 @@ menuScreen w screen = case screen of
|
||||
(WaitScreen sf _) -> drawOptions w (sf w) []
|
||||
(InputScreen s) -> drawOptions w ('>':s) []
|
||||
(DisplayScreen sd ) -> sd w
|
||||
(ColumnsScreen title pairs) -> drawTwoColumnsScreen (_config w) (_uvWorld w) title pairs
|
||||
(ColumnsScreen title pairs) -> drawTwoColumnsScreen (_config w) title pairs
|
||||
|
||||
--displayStringList :: World -> [String] -> Picture
|
||||
--displayStringList w ss = pictures
|
||||
@@ -28,15 +28,15 @@ menuScreen w screen = case screen of
|
||||
-- ys = [0,22..]
|
||||
-- f y s = translate (10-hw) y . scale 0.15 0.15 $ text s
|
||||
|
||||
drawTwoColumnsScreen :: Configuration -> World -> String -> [(String,String)] -> Picture
|
||||
drawTwoColumnsScreen cfig w title lps = pictures
|
||||
drawTwoColumnsScreen :: Configuration -> String -> [(String,String)] -> Picture
|
||||
drawTwoColumnsScreen cfig title lps = pictures
|
||||
[darkenBackground cfig
|
||||
,drawTitle cfig w title
|
||||
,drawTwoColumns cfig w lps
|
||||
,drawTitle cfig title
|
||||
,drawTwoColumns cfig lps
|
||||
]
|
||||
|
||||
drawTwoColumns :: Configuration -> World -> [(String,String)] -> Picture
|
||||
drawTwoColumns cfig w lps = pictures $ zipWith f [hh-100,hh-130..] lps
|
||||
drawTwoColumns :: Configuration -> [(String,String)] -> Picture
|
||||
drawTwoColumns cfig lps = pictures $ zipWith f [hh-100,hh-130..] lps
|
||||
where
|
||||
f y (s1,s2) = translate (50-hw) y $ sc $ rightPad ln '.' s1 ++ s2
|
||||
sc = scale 0.15 0.15 . color white . text
|
||||
@@ -49,11 +49,12 @@ drawOptions
|
||||
-> String -- ^ Title
|
||||
-> [MenuOption] -- ^ Options
|
||||
-> Picture
|
||||
drawOptions w title ops = pictures $
|
||||
[darkenBackground (_config w)
|
||||
,drawTitle (_config w) (_uvWorld w) title]
|
||||
++
|
||||
zipWith (\ s vpos -> placeString (-hw + 50) vpos 0.2 s) (map (menuOptionToString w) ops') [hh-100,hh-150 ..]
|
||||
drawOptions u title ops = pictures $
|
||||
[darkenBackground cfig
|
||||
, drawTitle cfig title] ++
|
||||
zipWith (\s vpos -> placeString (-hw + 50) vpos 0.2 s)
|
||||
(map (menuOptionToString u) ops')
|
||||
[hh-100,hh-150 ..]
|
||||
where
|
||||
ops' = filter notInvisible ops
|
||||
notInvisible InvisibleToggle {} = False
|
||||
@@ -61,13 +62,13 @@ drawOptions w title ops = pictures $
|
||||
placeString x y sc t = translate x y $ scale sc sc $ color white $ text t
|
||||
hh = halfHeight cfig
|
||||
hw = halfWidth cfig
|
||||
cfig = _config w
|
||||
cfig = _config u
|
||||
|
||||
darkenBackground :: Configuration -> Picture
|
||||
darkenBackground = color (withAlpha 0.5 black) . polygon . screenBox
|
||||
|
||||
drawTitle :: Configuration -> World -> String -> Picture
|
||||
drawTitle cfig w = placeString (-hw + 30) (hh - 50) 0.4
|
||||
drawTitle :: Configuration -> String -> Picture
|
||||
drawTitle cfig = placeString (-hw + 30) (hh - 50) 0.4
|
||||
where
|
||||
placeString x y sc t = translate x y $ scale sc sc $ color white $ text t
|
||||
hh = halfHeight cfig
|
||||
@@ -76,7 +77,6 @@ drawTitle cfig w = placeString (-hw + 30) (hh - 50) 0.4
|
||||
menuOptionToString :: Universe -> MenuOption -> String
|
||||
menuOptionToString w mo = theKeys ++ _moString mo w
|
||||
where
|
||||
theKeys :: String
|
||||
theKeys = case mo of
|
||||
Toggle {_moKey = k} -> stc k : ":"
|
||||
Toggle2 {_moKey1 = k1, _moKey2 = k2} -> stc k1 : '/' : stc k2 : ":"
|
||||
|
||||
Reference in New Issue
Block a user