Tweak automatic zooming
This commit is contained in:
Binary file not shown.
@@ -393,11 +393,6 @@ drawItemName w flIt | magV (_crPos (you w) -.- _flItPos flIt) < 100
|
|||||||
nameOfItem = _itName $ _flIt flIt
|
nameOfItem = _itName $ _flIt flIt
|
||||||
zoom = _cameraZoom w
|
zoom = _cameraZoom w
|
||||||
|
|
||||||
ringPict :: Drawing
|
|
||||||
ringPict = onLayer LabelLayer $ dShadCol white $ pictures [line [(-8,10),(-15,10),(-15,-10),(-8,-10)]
|
|
||||||
,line [( 8,10),( 15,10),( 15,-10),( 8,-10)]
|
|
||||||
]
|
|
||||||
|
|
||||||
dShadCol :: Color -> Picture -> Picture
|
dShadCol :: Color -> Picture -> Picture
|
||||||
dShadCol c p = pictures $
|
dShadCol c p = pictures $
|
||||||
[ color black $ uncurry translate (1.2,-1.2) p
|
[ color black $ uncurry translate (1.2,-1.2) p
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import Dodge.Data
|
|||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
import Dodge.WallCreatureCollisions
|
import Dodge.WallCreatureCollisions
|
||||||
import Dodge.LevelGen.Block
|
import Dodge.LevelGen.Block
|
||||||
import Dodge.Camera
|
import Dodge.Update.Camera
|
||||||
import Dodge.SoundLogic
|
import Dodge.SoundLogic
|
||||||
import Dodge.Inventory
|
import Dodge.Inventory
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module Dodge.Camera where
|
module Dodge.Update.Camera where
|
||||||
|
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -45,9 +45,6 @@ moveCamera w = w & cameraPos .~ idealPos
|
|||||||
sightFrom | isCam = camCenter
|
sightFrom | isCam = camCenter
|
||||||
| otherwise = ypos
|
| otherwise = ypos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
updateScopeZoom :: World -> World
|
updateScopeZoom :: World -> World
|
||||||
updateScopeZoom w
|
updateScopeZoom w
|
||||||
| SDL.ButtonRight `S.member` _mouseButtons w = case w ^? scppoint of
|
| SDL.ButtonRight `S.member` _mouseButtons w = case w ^? scppoint of
|
||||||
@@ -122,16 +119,13 @@ zoomCamOut w | SDL.KeycodeK `S.member` _keys w
|
|||||||
= w {_cameraZoom = max (_cameraZoom w - 0.01) 0.01}
|
= w {_cameraZoom = max (_cameraZoom w - 0.01) 0.01}
|
||||||
| otherwise = w
|
| otherwise = w
|
||||||
|
|
||||||
-- the 395 here limits the max zoom out, is 25 less than the current screen
|
|
||||||
-- size, thus matches up with it
|
|
||||||
zoomCam :: World -> World
|
zoomCam :: World -> World
|
||||||
--zoomCam w = w
|
|
||||||
zoomCam w = over cameraZoom changeZoom w
|
zoomCam w = over cameraZoom changeZoom w
|
||||||
where maxViewDistance = 800
|
where maxViewDistance = 800
|
||||||
camPos = _cameraCenter w
|
camPos = _cameraCenter w
|
||||||
camRot = _cameraRot w
|
camRot = _cameraRot w
|
||||||
wallZoom = min (halfWidth w / (horizontalMax+10) )
|
wallZoom = min (halfWidth w / (horizontalMax+50) )
|
||||||
(halfHeight w / (verticalMax+10) )
|
(halfHeight w / (verticalMax+50) )
|
||||||
idealZoom | SDL.ButtonRight `S.member` _mouseButtons w
|
idealZoom | SDL.ButtonRight `S.member` _mouseButtons w
|
||||||
= scZoom *
|
= scZoom *
|
||||||
(
|
(
|
||||||
@@ -143,10 +137,13 @@ zoomCam w = over cameraZoom changeZoom w
|
|||||||
= min (fromMaybe 20 $ yourItem w ^? itZoom . itZoomMax)
|
= min (fromMaybe 20 $ yourItem w ^? itZoom . itZoomMax)
|
||||||
$ max (fromMaybe 0.2 (yourItem w ^? itZoom . itZoomMin))
|
$ max (fromMaybe 0.2 (yourItem w ^? itZoom . itZoomMin))
|
||||||
(wallZoom * fromMaybe 1 (yourItem w ^? itZoom . itZoomFac))
|
(wallZoom * fromMaybe 1 (yourItem w ^? itZoom . itZoomFac))
|
||||||
changeZoom curZoom | curZoom > idealZoom + 0.01 = 0.05 * (19*curZoom + idealZoom)
|
changeZoom curZoom
|
||||||
| curZoom < idealZoom - 0.01 = 0.05 * (19*curZoom + idealZoom)
|
| curZoom > idealZoom + 0.01 = ((zoomOutSpeed-1)*curZoom + idealZoom) / zoomOutSpeed
|
||||||
| otherwise = idealZoom
|
| curZoom < idealZoom - 0.01 = ((zoomInSpeed-1)*curZoom + idealZoom) / zoomInSpeed
|
||||||
-- zs = take 20 [-maxViewDistance,0 - 0.9*maxViewDistance..]
|
| otherwise = idealZoom
|
||||||
|
-- these speeds are inverted, larger means slower
|
||||||
|
zoomInSpeed = 25
|
||||||
|
zoomOutSpeed = 15
|
||||||
zs = take 9 [-maxViewDistance,0 - 0.8*maxViewDistance..]
|
zs = take 9 [-maxViewDistance,0 - 0.8*maxViewDistance..]
|
||||||
rRays = rotF [( maxViewDistance,y) | y <- zs]
|
rRays = rotF [( maxViewDistance,y) | y <- zs]
|
||||||
lRays = rotF [(-maxViewDistance,y) | y <- zs]
|
lRays = rotF [(-maxViewDistance,y) | y <- zs]
|
||||||
Reference in New Issue
Block a user