Move from store to flat

This commit is contained in:
2022-08-20 17:54:35 +01:00
parent 8571ab9254
commit ff9dbdf068
95 changed files with 793 additions and 748 deletions
+9 -13
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.LightSource where
import Flat
import LinearHelp
import Control.Lens
import Data.Aeson
@@ -12,26 +15,25 @@ import TH.Derive
import Data.Store
data LightSourceDraw = DefaultLightSourceDraw
| HackLightSourceDraw
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data TLSIntensity
= ConstantIntensity
| TLSFade Point3 Int
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data TLSUpdate
= DestroyTLS
| TimerTLS
| IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data LSParam = LSParam
{ _lsPos :: !Point3
, _lsRad :: !Float
, _lsCol :: !Point3
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data LightSource = LS
{ _lsID :: Int
@@ -39,14 +41,14 @@ data LightSource = LS
, _lsDir :: Float
, _lsPict :: LightSourceDraw --LightSource -> Picture
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
data TempLightSource = TLS
{ _tlsParam :: LSParam
, _tlsUpdate :: TLSUpdate --TempLightSource -> Maybe TempLightSource
, _tlsTime :: Int
}
deriving (Eq, Ord, Show, Read)
deriving (Eq, Ord, Show, Read, Generic, Flat)
makeLenses ''LSParam
makeLenses ''LightSource
@@ -57,9 +59,3 @@ deriveJSON defaultOptions ''TLSUpdate
deriveJSON defaultOptions ''LSParam
deriveJSON defaultOptions ''LightSource
deriveJSON defaultOptions ''TempLightSource
$($(derive [d| instance Deriving (Store LightSourceDraw) |]))
$($(derive [d| instance Deriving (Store TLSIntensity) |]))
$($(derive [d| instance Deriving (Store TLSUpdate) |]))
$($(derive [d| instance Deriving (Store LSParam) |]))
$($(derive [d| instance Deriving (Store LightSource) |]))
$($(derive [d| instance Deriving (Store TempLightSource) |]))