Rethink item ammo to item consumables, start item type datatype

This commit is contained in:
2021-11-29 16:22:31 +00:00
parent 3a605b8156
commit f40d486d68
31 changed files with 238 additions and 193 deletions
+13 -2
View File
@@ -11,7 +11,7 @@ data Configuration = Configuration
, _volume_music :: Float
, _wall_textured :: Bool
, _cloud_shadows :: Bool
, _resolution_factor :: Int -- ^ Higher values divide screen size, i.e. make the resolution worse
, _resolution_factor :: ResFactor
, _windowX :: Float
, _windowY :: Float
, _windowPosX :: Int
@@ -25,6 +25,17 @@ data Configuration = Configuration
, _debug_pathing :: Bool
}
deriving (Generic, Show)
data ResFactor = FullRes | HalfRes | QuarterRes
deriving (Generic, Show, Eq, Ord, Enum, Bounded)
instance ToJSON ResFactor where
toEncoding = genericToEncoding defaultOptions
instance FromJSON ResFactor
resFactorNum :: ResFactor -> Int
resFactorNum rf = case rf of
FullRes -> 1
HalfRes -> 2
QuarterRes -> 4
makeLenses ''Configuration
instance ToJSON Configuration where
@@ -39,7 +50,7 @@ defaultConfig = Configuration
, _volume_music = 1
, _wall_textured = True
, _cloud_shadows = True
, _resolution_factor = 1
, _resolution_factor = FullRes
, _windowX = 800
, _windowY = 600
, _windowPosX = 0