Work towards making world read/showable

This commit is contained in:
2022-07-22 11:16:12 +01:00
parent 6b69fc1684
commit 7fdb70dd1c
22 changed files with 223 additions and 218 deletions
+6 -6
View File
@@ -86,8 +86,8 @@ debugMenuOptions = zipWith ($)
$ map Scancode [4..]
where
f :: DebugBool -> Scancode -> MenuOption
f bd = Toggle (return . Just . (config . debug_booleans . at bd %~ toggleJust))
(Right . g bd . (^? config . debug_booleans . ix bd))
f bd = Toggle (return . Just . (uvConfig . debug_booleans . at bd %~ toggleJust))
(Right . g bd . (^? uvConfig . debug_booleans . ix bd))
g bd Nothing = (show bd, "False")
g bd _ = (show bd, "True")
-- zipWith ($)
@@ -133,14 +133,14 @@ soundMenuOptions =
(change dec stype)
scod2
(change inc stype)
(\w -> Right (str , leftPad 2 '.' $ show (round $ 10 * voltype (_config w)::Int)))
change g vt = return . Just . (config . vt %~ g) . sw
(\w -> Right (str , leftPad 2 '.' $ show (round $ 10 * voltype (_uvConfig w)::Int)))
change g vt = return . Just . (uvConfig . vt %~ g) . sw
dec x = max 0 (x - 0.1)
inc x = min 1 (x + 0.1)
sw w = w & uvWorld . sideEffects %~ setVolThen (_config w)
sw w = w & uvWorld . sideEffects %~ setVolThen (_uvConfig w)
writeConfig :: Universe -> Universe
writeConfig w = w & uvWorld . sideEffects %~ saveConfig (_config w)
writeConfig w = w & uvWorld . sideEffects %~ saveConfig (_uvConfig w)
graphicsMenu :: ScreenLayer
graphicsMenu = slTitleOptions "OPTIONS:GRAPHICS" graphicsMenuOptions