Refactor light sources

This commit is contained in:
2021-11-28 16:53:26 +00:00
parent 1d9dd3e4e0
commit 618653a86e
28 changed files with 169 additions and 155 deletions
+10 -10
View File
@@ -11,7 +11,7 @@ import Dodge.Base
import Dodge.Zone
import Dodge.Base.Window
import Dodge.Base.Collide
import Dodge.Config.KeyConfig
--import Dodge.Config.KeyConfig
import Geometry
--import Geometry.ConvexPoly
import Dodge.GameRoom
@@ -135,11 +135,11 @@ rotateCamera w
| keyr = rotateCameraBy (-0.025) w
| otherwise = ifConfigWallRotate w
where
keyl = rotateCameraPlusKey (_keyConfig w) `S.member` _keys w
keyr = rotateCameraMinusKey (_keyConfig w) `S.member` _keys w
keyl = SDL.ScancodeQ `S.member` _keys w
keyr = SDL.ScancodeE `S.member` _keys w
zoomCamBy :: Float -> World -> World
zoomCamBy x w = w {_cameraZoom = max (_cameraZoom w + x) 0.01}
--zoomCamBy :: Float -> World -> World
--zoomCamBy x w = w {_cameraZoom = max (_cameraZoom w + x) 0.01}
zoomFromItem
:: ItZoom
@@ -154,11 +154,11 @@ zoomNoItem = min 20 . max 0.2
{- Automatically sets the zoom of the camera according to the surrounding walls. -}
autoZoomCamera :: World -> World
autoZoomCamera w
| zoomInKey (_keyConfig w) `S.member` _keys w
= zoomCamBy 0.01 w
| zoomOutKey (_keyConfig w) `S.member` _keys w
= zoomCamBy (-0.01) w
| otherwise = w & cameraZoom %~ changeZoom
-- | zoomInKey (_keyConfig w) `S.member` _keys w
-- = zoomCamBy 0.01 w
-- | zoomOutKey (_keyConfig w) `S.member` _keys w
-- = zoomCamBy (-0.01) w
= w & cameraZoom %~ changeZoom
where
camPos = _cameraViewFrom w
wallZoom = farWallDist camPos w