Files
loop/src/Dodge/Config/Data.hs
T
2021-05-17 22:39:18 +02:00

50 lines
1.2 KiB
Haskell

{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
module Dodge.Config.Data (
Configuration (..)
, defaultConfig
, volume_master
, volume_sound
, volume_music
, wall_textured
, shadow_resolution
, windowX
, windowY
) where
import Data.Aeson
import GHC.Generics
--import System.Directory
import Control.Lens
data Configuration = Configuration
{ _volume_master :: Float
, _volume_sound :: Float
, _volume_music :: Float
, _wall_textured :: Bool
, _shadow_resolution :: Int -- ^ Higher values divide screen size, i.e. make the resolution worse
, _windowX :: Float
, _windowY :: Float
}
deriving (Generic, Show)
makeLenses ''Configuration
instance ToJSON Configuration where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Configuration
defaultConfig :: Configuration
defaultConfig = Configuration
{ _volume_master = 1
, _volume_sound = 1
, _volume_music = 1
, _wall_textured = False
, _shadow_resolution = 1
, _windowX = 800
, _windowY = 600
}