Move towards serializing saves/loads faster
This commit is contained in:
@@ -64,7 +64,7 @@ drawOptions u title ops off footer =
|
||||
, drawFooterText cfig red footer
|
||||
]
|
||||
++ zipWith
|
||||
(\s vpos -> placeString (- hw + 50) vpos 0.2 s)
|
||||
(\s vpos -> placeColorString (- hw + 50) vpos 0.2 s)
|
||||
ops''
|
||||
[hh -100, hh -150 ..]
|
||||
where
|
||||
@@ -77,7 +77,7 @@ drawOptions u title ops off footer =
|
||||
x | x < length ops -> take (availableMenuLines cfig) (drop off visibleops)
|
||||
_ -> visibleops
|
||||
ops'' = case availableMenuLines cfig of
|
||||
x | x < length ops -> map (menuOptionToString u maxOptionLength) ops' ++ ["SPACE: MORE OPTIONS"]
|
||||
x | x < length ops -> map (menuOptionToString u maxOptionLength) ops' ++ [(white,"SPACE: MORE OPTIONS")]
|
||||
_ -> map (menuOptionToString u maxOptionLength) ops'
|
||||
visibleops = filter notInvisible ops
|
||||
notInvisible InvisibleToggle{} = False
|
||||
@@ -88,8 +88,8 @@ drawOptions u title ops off footer =
|
||||
|
||||
optionValueOffset :: Universe -> MenuOption -> Int
|
||||
optionValueOffset u mo = case _moString mo u of
|
||||
Left _ -> 0
|
||||
Right (s, _) -> length s
|
||||
MODStringOption s _ -> length s
|
||||
_ -> 0
|
||||
|
||||
darkenBackground :: Configuration -> Picture
|
||||
darkenBackground = color (withAlpha 0.5 black) . polygon . reverse . screenBox
|
||||
@@ -111,18 +111,32 @@ placeString ::
|
||||
Picture
|
||||
placeString x y sc = color white . translate x y . scale sc sc . text
|
||||
|
||||
placeColorString ::
|
||||
-- | x distance from center
|
||||
Float ->
|
||||
-- | y distance from center
|
||||
Float ->
|
||||
-- | scale
|
||||
Float ->
|
||||
(Color,String) ->
|
||||
Picture
|
||||
placeColorString x y sc (col,str) = color col . translate x y . scale sc sc . text $ str
|
||||
|
||||
drawFooterText :: Configuration -> Color -> String -> Picture
|
||||
drawFooterText cfig col = color col . placeString (- hw + 30) (- hh + 10) 0.1
|
||||
where
|
||||
hh = halfHeight cfig
|
||||
hw = halfWidth cfig
|
||||
|
||||
menuOptionToString :: Universe -> Int -> MenuOption -> String
|
||||
menuOptionToString w padAmount mo = theKeys ++ optionText
|
||||
menuOptionToString :: Universe -> Int -> MenuOption -> (Color,String)
|
||||
menuOptionToString w padAmount mo = (thecol,theKeys ++ optionText)
|
||||
where
|
||||
thecol = case _moString mo w of
|
||||
MODBlockedString {} -> greyN 0.5
|
||||
_ -> white
|
||||
optionText = case _moString mo w of
|
||||
Left s -> s
|
||||
Right (s, t) -> rightPad padAmount '.' s ++ t
|
||||
MODStringOption s t -> rightPad padAmount '.' s ++ t
|
||||
x -> _modString x
|
||||
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