Push preloaddata into the universe
This commit is contained in:
+9
-7
@@ -7,11 +7,12 @@ module Dodge.Menu
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.PreloadData
|
||||
import Dodge.Save
|
||||
import Dodge.Config.Update
|
||||
import SDL
|
||||
import SDL.Internal.Numbered
|
||||
import Preload.Update
|
||||
--import Preload.Update
|
||||
import Dodge.Base.Window
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.LevelGen
|
||||
@@ -165,7 +166,8 @@ startNewGame w = Just $ w
|
||||
|
||||
uvWorldSideEffects :: Int -> World -> b -> IO World
|
||||
uvWorldSideEffects i w = const (generateWorldFromSeed i <&> keyConfig .~ _keyConfig w <&> config .~ _config w
|
||||
<&> preloadData .~ _preloadData w)
|
||||
-- <&> preloadData .~ _preloadData w
|
||||
)
|
||||
-- this kills save games etc...
|
||||
|
||||
|
||||
@@ -177,14 +179,14 @@ scodeToChar = toEnum . (+ 61) . fromIntegral . toNumber
|
||||
--charToScode = Scancode . fromIntegral . (\x -> x - 61) . fromEnum
|
||||
|
||||
updateFramebufferSize :: World -> World
|
||||
updateFramebufferSize w = w & sideEffects %~ up
|
||||
updateFramebufferSize w = w & sideEffects %~ sideEffectUpdatePreload divRes x y
|
||||
where
|
||||
(x,y) = (round $ getWindowX w, round $ getWindowY w)
|
||||
divRes = w ^. config . resolution_factor
|
||||
up :: (Universe -> IO Universe) -> Universe -> IO Universe
|
||||
up f w' = do
|
||||
pdata <- pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y (_preloadData (_uvWorld w'))
|
||||
f $ w' & uvWorld . preloadData .~ pdata
|
||||
-- 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' & uvWorld . preloadData .~ pdata
|
||||
|
||||
--levelMenu :: Int -> ScreenLayer
|
||||
--levelMenu x = OptionScreen
|
||||
|
||||
Reference in New Issue
Block a user