Prettify saved config
This commit is contained in:
@@ -45,6 +45,7 @@ dependencies:
|
|||||||
- foldl
|
- foldl
|
||||||
- linear
|
- linear
|
||||||
- aeson
|
- aeson
|
||||||
|
- aeson-pretty
|
||||||
- directory
|
- directory
|
||||||
- extra
|
- extra
|
||||||
- primitive
|
- primitive
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ data Configuration = Configuration
|
|||||||
, _debug_seconds_frame :: Bool
|
, _debug_seconds_frame :: Bool
|
||||||
, _debug_noclip :: Bool
|
, _debug_noclip :: Bool
|
||||||
, _debug_cr_status :: Bool
|
, _debug_cr_status :: Bool
|
||||||
|
, _debug_cr_awareness :: Bool
|
||||||
, _debug_view_boundaries :: Bool
|
, _debug_view_boundaries :: Bool
|
||||||
, _debug_view_clip_bounds :: RoomClipping
|
, _debug_view_clip_bounds :: RoomClipping
|
||||||
, _debug_pathing :: Bool
|
, _debug_pathing :: Bool
|
||||||
@@ -66,6 +67,7 @@ defaultConfig = Configuration
|
|||||||
, _debug_seconds_frame = True
|
, _debug_seconds_frame = True
|
||||||
, _debug_noclip = False
|
, _debug_noclip = False
|
||||||
, _debug_cr_status = False
|
, _debug_cr_status = False
|
||||||
|
, _debug_cr_awareness = False
|
||||||
, _debug_view_boundaries = False
|
, _debug_view_boundaries = False
|
||||||
, _debug_view_clip_bounds = NoRoomClipBoundaries
|
, _debug_view_clip_bounds = NoRoomClipBoundaries
|
||||||
, _debug_pathing = False
|
, _debug_pathing = False
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import Sound
|
|||||||
import Data.Preload
|
import Data.Preload
|
||||||
import Preload.Update
|
import Preload.Update
|
||||||
|
|
||||||
import Data.Aeson (encodeFile)
|
--import Data.Aeson (encodeFile)
|
||||||
|
import Data.Aeson.Encode.Pretty (encodePretty)
|
||||||
|
import qualified Data.ByteString.Lazy as BS
|
||||||
--import Control.Monad (when)
|
--import Control.Monad (when)
|
||||||
{- |
|
{- |
|
||||||
Write the current world configuration to disk as a json file.
|
Write the current world configuration to disk as a json file.
|
||||||
@@ -20,7 +22,8 @@ Write the current world configuration to disk as a json file.
|
|||||||
saveConfig :: Configuration -> (a -> IO a) -> a -> IO a
|
saveConfig :: Configuration -> (a -> IO a) -> a -> IO a
|
||||||
saveConfig cfig f x = do
|
saveConfig cfig f x = do
|
||||||
putStrLn "Saving config to data/dodge.config.json"
|
putStrLn "Saving config to data/dodge.config.json"
|
||||||
encodeFile "data/dodge.config.json" cfig
|
BS.writeFile "data/dodge.config.json" $ encodePretty cfig
|
||||||
|
-- encodeFile "data/dodge.config.json" cfig
|
||||||
f x
|
f x
|
||||||
{- |
|
{- |
|
||||||
Apply the volume settings from the world configuration to the running game.
|
Apply the volume settings from the world configuration to the running game.
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ basicCrShape col cr = tr . scaleSH (V3 crsize crsize crsize) $ mconcat
|
|||||||
|
|
||||||
creatureDisplayText :: Configuration -> World -> Creature -> Picture
|
creatureDisplayText :: Configuration -> World -> Creature -> Picture
|
||||||
creatureDisplayText cfig w cr
|
creatureDisplayText cfig w cr
|
||||||
| not (_debug_cr_status cfig) = []
|
| not (_debug_cr_awareness cfig) = []
|
||||||
| otherwise
|
| otherwise
|
||||||
= setLayer DebugLayer
|
= setLayer DebugLayer
|
||||||
. setDepth 20
|
. setDepth 20
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ debugMenuOptions =
|
|||||||
[ doption ScancodeF debug_seconds_frame "SHOW SECONDS/FRAME" _debug_seconds_frame
|
[ doption ScancodeF debug_seconds_frame "SHOW SECONDS/FRAME" _debug_seconds_frame
|
||||||
, doption ScancodeC debug_noclip "NOCLIP" _debug_noclip
|
, doption ScancodeC debug_noclip "NOCLIP" _debug_noclip
|
||||||
, doption ScancodeS debug_cr_status "SHOW CREATURE STATUS" _debug_cr_status
|
, doption ScancodeS debug_cr_status "SHOW CREATURE STATUS" _debug_cr_status
|
||||||
|
, doption ScancodeA debug_cr_awareness "SHOW CREATURE AWARENESS" _debug_cr_awareness
|
||||||
, doption ScancodeV debug_view_boundaries "SHOW VIEW BOUNDARIES" _debug_view_boundaries
|
, doption ScancodeV debug_view_boundaries "SHOW VIEW BOUNDARIES" _debug_view_boundaries
|
||||||
, makeEnumOption ScancodeB debug_view_clip_bounds "SHOW ROOM CLIP" return
|
, makeEnumOption ScancodeB debug_view_clip_bounds "SHOW ROOM CLIP" return
|
||||||
, doption ScancodeP debug_pathing "SHOW PATHING" _debug_pathing
|
, doption ScancodeP debug_pathing "SHOW PATHING" _debug_pathing
|
||||||
|
|||||||
@@ -122,9 +122,10 @@ crDisplayInfo cfig w cr
|
|||||||
|
|
||||||
drawCrInfo :: Configuration -> World -> Picture
|
drawCrInfo :: Configuration -> World -> Picture
|
||||||
drawCrInfo cfig w
|
drawCrInfo cfig w
|
||||||
= setLayer FixedCoordLayer
|
-- | _debug_cr_awareness cfig = setLayer FixedCoordLayer
|
||||||
$ renderInfoListsAt (2*hw - 200) 0 cfig w
|
-- $ renderInfoListsAt (2*hw - 200) 0 cfig w
|
||||||
$ mapMaybe (crDisplayInfo cfig w) $ IM.elems $ _creatures w
|
-- $ mapMaybe (crDisplayInfo cfig w) $ IM.elems $ _creatures w
|
||||||
|
| otherwise = mempty
|
||||||
where
|
where
|
||||||
hw = halfWidth cfig
|
hw = halfWidth cfig
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user