{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-}
module Dodge.Config.Data (
      Configuration (..)
    , defaultConfig
    , volume_master
    , volume_sound
    , volume_music
    , wall_textured
    , cloud_shadows
    , resolution_factor
    , windowX
    , windowY
    , rotate_to_wall
    , show_sound
    ) 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
    , _cloud_shadows        :: Bool
    , _resolution_factor    :: Int -- ^ Higher values divide screen size, i.e. make the resolution worse
    , _windowX              :: Float
    , _windowY              :: Float
    , _rotate_to_wall       :: Bool
    , _show_sound           :: Bool
    }
  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        = True
    , _cloud_shadows        = True
    , _resolution_factor    = 1
    , _windowX              = 800
    , _windowY              = 600
    , _rotate_to_wall       = True
    , _show_sound           = False
    }
