Refactor, try to limit dependencies
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Universe (
|
||||
module Dodge.Data.Universe,
|
||||
module Dodge.Data.Config,
|
||||
module Dodge.Data.World,
|
||||
module Data.Preload,
|
||||
module Picture.Data,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Preload
|
||||
import qualified Data.Text as T
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.World
|
||||
import Picture.Data
|
||||
import SDL (Scancode)
|
||||
|
||||
data Universe = Universe
|
||||
{ _uvWorld :: World
|
||||
, _preloadData :: PreloadData
|
||||
, _menuLayers :: [ScreenLayer]
|
||||
, _savedWorlds :: M.Map SaveSlot World
|
||||
, _uvIOEffects :: Universe -> IO Universe
|
||||
, _uvConfig :: Configuration
|
||||
, _uvTestString :: Universe -> [String]
|
||||
}
|
||||
|
||||
data SaveSlot
|
||||
= QuicksaveSlot
|
||||
| LevelStartSlot
|
||||
| SaveSlotNum Int
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data OptionScreenFlag = NormalOptions | GameOverOptions
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ScreenLayer
|
||||
= OptionScreen
|
||||
{ _scTitle :: Universe -> String
|
||||
, _scOptions :: [MenuOption]
|
||||
, _scDefaultEff :: Universe -> IO (Maybe Universe)
|
||||
, _scOptionFlag :: OptionScreenFlag
|
||||
, _scOptionsOffset :: Int
|
||||
}
|
||||
| ColumnsScreen
|
||||
{ _scTitle :: Universe -> String
|
||||
, _scColumns :: [(String, String)]
|
||||
}
|
||||
| InputScreen
|
||||
{ _scInput :: T.Text
|
||||
, _scFooter :: String
|
||||
}
|
||||
| WaitScreen
|
||||
{ _scWaitMessage :: Universe -> String
|
||||
, _scWaitTime :: Int
|
||||
}
|
||||
| DisplayScreen
|
||||
{ _scDisplay :: Universe -> Picture
|
||||
}
|
||||
|
||||
data MenuOption
|
||||
= Toggle
|
||||
{ _moEff :: Universe -> IO (Maybe Universe)
|
||||
, _moString :: Universe -> Either String (String, String)
|
||||
, _moKey :: Scancode
|
||||
}
|
||||
| Toggle2
|
||||
{ _moKey1 :: Scancode
|
||||
, _moEff1 :: Universe -> IO (Maybe Universe)
|
||||
, _moKey2 :: Scancode
|
||||
, _moEff2 :: Universe -> IO (Maybe Universe)
|
||||
, _moString :: Universe -> Either String (String, String)
|
||||
}
|
||||
| InvisibleToggle
|
||||
{ _moKey :: Scancode
|
||||
, _moEff :: Universe -> IO (Maybe Universe)
|
||||
}
|
||||
|
||||
data IntID a = IntID Int a
|
||||
|
||||
makeLenses ''Universe
|
||||
makeLenses ''ScreenLayer
|
||||
Reference in New Issue
Block a user