Add frame clock

This commit is contained in:
2021-09-09 13:29:09 +01:00
parent a2288110ae
commit be7b2d2cd7
27 changed files with 176 additions and 87 deletions
+9 -5
View File
@@ -53,7 +53,8 @@ soundMenuOptions =
where
dec x = max 0 (x - 0.1)
inc x = min 1 (x + 0.1)
sw w = w & sideEffects %~ (setVol (_config w) : )
--sw w = w & sideEffects %~ (setVol (_config w) : )
sw w = w & sideEffects %~ setVol' (_config w)
master g = Just . (config . volume_master %~ g)
soundEffs g = Just . (config . volume_sound %~ g)
music g = Just . (config . volume_music %~ g)
@@ -70,7 +71,7 @@ popScreen :: World -> Maybe World
popScreen = Just . (menuLayers %~ tail)
writeConfig :: World -> World
writeConfig w = w & sideEffects %~ (saveConfig (_config w) :)
writeConfig w = w & sideEffects %~ saveConfig (_config w)
graphicsMenu :: ScreenLayer
graphicsMenu = OptionScreen
@@ -138,12 +139,15 @@ charToScode :: Char -> Scancode
charToScode = Scancode . fromIntegral . (\x -> x - 61) . fromEnum
updateFramebufferSize :: World -> World
updateFramebufferSize w = w & sideEffects
%~ (pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y : )
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 f w' = do
pdata <- pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y (_preloadData w')
f $ w' & preloadData .~ pdata
levelMenu :: Int -> ScreenLayer
levelMenu x = OptionScreen
{ _scTitle = const $ "LEVEL "++ show x