Rethink item ammo to item consumables, start item type datatype
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@ setVol :: Configuration -> IO ()
|
||||
setVol cfig = do
|
||||
setSoundVolume ( _volume_master cfig * _volume_sound cfig)
|
||||
setMusicVolume ( _volume_master cfig * _volume_music cfig)
|
||||
|
||||
-- what?
|
||||
setVolThen :: Configuration -> (a -> IO a) -> a -> IO a
|
||||
setVolThen cfig f a = do
|
||||
setVol cfig
|
||||
@@ -47,4 +47,4 @@ applyWorldConfig cfig pdata = do
|
||||
where
|
||||
x = round $ _windowX cfig
|
||||
y = round $ _windowY cfig
|
||||
divRes = _resolution_factor cfig
|
||||
divRes = resFactorNum $ _resolution_factor cfig
|
||||
|
||||
Reference in New Issue
Block a user