Apply side effects to universe not world
This commit is contained in:
+10
-5
@@ -159,11 +159,16 @@ pauseMenuOptions =
|
||||
startNewGame :: World -> Maybe World
|
||||
startNewGame w = Just $ w
|
||||
& menuLayers .~ [WaitScreen (const "GENERATING...") 1]
|
||||
& sideEffects .~ const (generateWorldFromSeed i <&> keyConfig .~ _keyConfig w <&> config .~ _config w
|
||||
<&> preloadData .~ _preloadData w) -- this kills save games etc...
|
||||
& sideEffects .~ uvWorld (uvWorldSideEffects i w)
|
||||
where
|
||||
i = fst $ random (_randGen w)
|
||||
|
||||
uvWorldSideEffects :: Int -> World -> b -> IO World
|
||||
uvWorldSideEffects i w = const (generateWorldFromSeed i <&> keyConfig .~ _keyConfig w <&> config .~ _config w
|
||||
<&> preloadData .~ _preloadData w)
|
||||
-- this kills save games etc...
|
||||
|
||||
|
||||
-- | hacky
|
||||
scodeToChar :: Scancode -> Char
|
||||
scodeToChar = toEnum . (+ 61) . fromIntegral . toNumber
|
||||
@@ -176,10 +181,10 @@ updateFramebufferSize w = w & sideEffects %~ up
|
||||
where
|
||||
(x,y) = (round $ getWindowX w, round $ getWindowY w)
|
||||
divRes = w ^. config . resolution_factor
|
||||
up :: (World -> IO World) -> World -> IO World
|
||||
up :: (Universe -> IO Universe) -> Universe -> IO Universe
|
||||
up f w' = do
|
||||
pdata <- pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y (_preloadData w')
|
||||
f $ w' & preloadData .~ pdata
|
||||
pdata <- pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y (_preloadData (_uvWorld w'))
|
||||
f $ w' & uvWorld . preloadData .~ pdata
|
||||
|
||||
--levelMenu :: Int -> ScreenLayer
|
||||
--levelMenu x = OptionScreen
|
||||
|
||||
Reference in New Issue
Block a user