module Dodge.PreloadData where import Control.Lens import Dodge.Data.Universe import Preload.Update sideEffectUpdatePreload :: Int -> Int -> Int -> (Universe -> IO Universe) -> Universe -> IO Universe sideEffectUpdatePreload divRes x y f u = do -- GL.viewport $= (GL.Position 0 0, GL.Size (fromIntegral x) (fromIntegral y)) pdata <- pdataResizeUpdate (u ^. uvConfig) (x `div` divRes) (y `div` divRes) x y (_preloadData u) f $ u & preloadData .~ pdata updatePreload :: Int -> Int -> Int -> Universe -> IO Universe updatePreload divRes x y u = do pdata <- pdataResizeUpdate (u ^. uvConfig) (x `div` divRes) (y `div` divRes) x y (_preloadData u) return $ u & preloadData .~ pdata updateFramebufferSize :: Universe -> IO Universe updateFramebufferSize u = updatePreload divRes x y u where (x, y) = (round $ _windowX cfig, round $ _windowY cfig) cfig = _uvConfig u divRes = resFactorNum $ u ^. uvConfig . graphics_world_resolution