Implement different shadow resolutions

This commit is contained in:
jgk
2021-04-28 23:16:42 +02:00
parent 8cb177a21c
commit 750a67ea6e
8 changed files with 63 additions and 42 deletions
+14 -1
View File
@@ -9,6 +9,7 @@ import Dodge.SoundLogic
import Dodge.Config.Data
import Dodge.Config.Update
import Dodge.Layout
import Preload.Update
import Data.Maybe
import qualified Data.Set as S
@@ -49,7 +50,8 @@ handlePressedKeyInMenu mState scode w = case mState of
ScancodeM -> Just $ sw & config . volume_music %~ inc
_ -> popMenu $ w & sideEffects %~ (saveConfig (_config w) :)
GraphicsOptionMenu -> case scode of
ScancodeW -> Just $ w & config . wall_textured %~ not
ScancodeW -> Just $ w & config . wall_textured %~ not
ScancodeS -> Just $ updateFramebufferSize $ w & config . shadow_resolution %~ cycleResolution
_ -> popMenu $ w & sideEffects %~ (saveConfig (_config w) :)
ControlList -> Just $ w & menuLayers %~ tail
_ -> Just w
@@ -68,6 +70,17 @@ handlePressedKeyInMenu mState scode w = case mState of
& windowX .~ _windowX w
& windowY .~ _windowY w
updateFramebufferSize :: World -> World
updateFramebufferSize w = w & sideEffects
%~ (resizeSpareFBO (ceiling x `div` divRes) (ceiling y `div` divRes) : )
where
(x,y) = (_windowX w, _windowY w)
divRes = w ^. config . shadow_resolution
cycleResolution 1 = 2
cycleResolution 2 = 4
cycleResolution 4 = 1
storeLevel :: World -> World
storeLevel w = case _storedLevel w of
Nothing -> w & storedLevel ?~ w