This commit is contained in:
2022-12-28 01:12:10 +00:00
parent c71af99ff7
commit 2d4a55dee0
8 changed files with 35 additions and 21 deletions
+10
View File
@@ -4,7 +4,9 @@ module Dodge.Menu (
splashMenu,
) where
import qualified Data.Aeson.Encode.Pretty as AEP
import Control.Monad
import Data.ByteString.Lazy.Char8 (unpack)
--import SDL
import Data.Maybe
@@ -41,6 +43,7 @@ splashMenuOptions =
, Toggle (pushScreen $ seedStartMenu "START FROM SEED") (opText "NEW WITH SPECIFIC SEED")
, Toggle (pushScreen optionMenu) (opText "OPTIONS")
, Toggle (pushScreen displayControls) (opText "VIEW CONTROLS")
, Toggle (pushScreen displayConfig) (opText "VIEW CONFIG")
, Toggle id (displaywhenseed "VIEW LAST SEED")
, Toggle hardQuit (opText "QUIT")
]
@@ -200,6 +203,13 @@ gameOverMenu u =
unpause :: Universe -> Universe
unpause w = resumeSound $ w & uvScreenLayers .~ []
-- note that this won't update after it is first loaded
displayConfig :: Universe -> ScreenLayer
displayConfig u = titleOptionsNoWrite "CONFIG" (map (Toggle id . const . MODString) $ listConfig u) u
listConfig :: Universe -> [String]
listConfig u = lines $ unpack $ AEP.encodePretty' (AEP.Config (AEP.Spaces 2) compare AEP.Generic False) $ u ^. uvConfig
displayControls :: Universe -> ScreenLayer
--displayControls = const $ ColumnsScreen "CONTROLS" listControls
displayControls = titleOptionsNoWrite "CONTROLS" $ map (Toggle id . const . uncurry MODStringOption) listControls