Block screen during long loading
This commit is contained in:
@@ -3,9 +3,10 @@ module Dodge.StartNewGame (
|
||||
startSeedGame,
|
||||
) where
|
||||
|
||||
import Dodge.Menu.Loading
|
||||
import Dodge.Concurrent
|
||||
--import Dodge.Menu.Option
|
||||
import Control.Lens
|
||||
import LensHelp
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.LevelGen
|
||||
import Dodge.Save
|
||||
@@ -16,8 +17,13 @@ startNewGameInSlot slot u = startSeedGame slot i u
|
||||
where
|
||||
i = fst $ randomR (0, maxBound) (_randGen (_uvWorld u))
|
||||
|
||||
|
||||
blockingLoad :: String -> IO (Universe -> Maybe Universe) -> Universe -> Universe
|
||||
blockingLoad str f u = u & uvScreenLayers .:~ loadingScreen str
|
||||
& addSideEffect f str
|
||||
|
||||
startSeedGame :: Int -> Int -> Universe -> Universe
|
||||
startSeedGame _ i = addSideEffect (startSeedGameConc i) "GENERATING"
|
||||
startSeedGame _ i = blockingLoad "LOADING" (startSeedGameConc i)
|
||||
|
||||
startSeedGameConc :: Int -> IO (Universe -> Maybe Universe)
|
||||
startSeedGameConc seed = do
|
||||
|
||||
Reference in New Issue
Block a user