Zoom in when spawning
This commit is contained in:
@@ -8,6 +8,7 @@ module Dodge.Base.Window (
|
||||
pointIsOnScreen,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
import Control.Lens
|
||||
import Dodge.Data.Camera
|
||||
import Dodge.Data.Config
|
||||
@@ -19,9 +20,9 @@ screenPolygon cfig w = map (scTran . scRot . scZoom) $ screenBox cfig
|
||||
where
|
||||
scRot = rotateV (w ^. camRot)
|
||||
scZoom p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *.* p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *^ p
|
||||
| otherwise = p
|
||||
scTran p = p +.+ (w ^. camCenter)
|
||||
scTran p = p + (w ^. camCenter)
|
||||
|
||||
-- | A box covering the screen in world coordinates, with a x and y border
|
||||
screenPolygonBord ::
|
||||
@@ -37,9 +38,9 @@ screenPolygonBord xbord ybord cfig w = [tr, tl, bl, br]
|
||||
hw = halfWidth cfig - xbord
|
||||
hh = halfHeight cfig - ybord
|
||||
scZoom p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *.* p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *^ p
|
||||
| otherwise = p
|
||||
theTransform = (+.+ (w ^. camCenter)) . rotateV (w ^. camRot) . scZoom
|
||||
theTransform = (+ (w ^. camCenter)) . rotateV (w ^. camRot) . scZoom
|
||||
tr = theTransform (V2 hw hh)
|
||||
tl = theTransform (V2 (- hw) hh)
|
||||
br = theTransform (V2 hw (- hh))
|
||||
|
||||
@@ -46,9 +46,9 @@ outsideScreenPolygon cfig w = [tr, tl, bl, br]
|
||||
where
|
||||
scRot = rotateV (w ^. camRot)
|
||||
scZoom p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *.* p
|
||||
| (w ^. camZoom) /= 0 = (1 / (w ^. camZoom)) *^ p
|
||||
| otherwise = error "Trying to set screen zoom to zero"
|
||||
scTran p = p +.+ (w ^. camCenter)
|
||||
scTran p = p + (w ^. camCenter)
|
||||
tr = f 3 3
|
||||
tl = f (-3) 3
|
||||
br = f 3 (-3)
|
||||
|
||||
@@ -24,7 +24,8 @@ drawMenuScreen mi = \case
|
||||
drawLoadingScreen :: [String] -> BlockStatus -> Config -> Picture
|
||||
drawLoadingScreen s _ cfig =
|
||||
polygon (rectWH (fromIntegral (cfig ^. windowX)) (fromIntegral (cfig ^. windowY)))
|
||||
<> translateScreenPos
|
||||
<>
|
||||
translateScreenPos
|
||||
cfig
|
||||
(ScreenPos (V2 0 0.2) (V2 (-300) (10 * fromIntegral (length s))))
|
||||
(drawList $ map text s)
|
||||
|
||||
@@ -13,7 +13,8 @@ respawn w = w & uncurry spawnAt (w ^. cWorld . lWorld . respawnPos)
|
||||
|
||||
spawnAt :: Point2 -> Float -> World -> World
|
||||
spawnAt p d w = w
|
||||
& wCam . camZoom .~ 1000
|
||||
& wCam . camZoom .~ 0.000000001
|
||||
& wCam . camDefaultZoom .~ 0.000000001
|
||||
& wSoundFilter .~ FilterBySoundOrigin (S.singleton SpawnSound)
|
||||
-- & cWorld . lWorld . creatures . at 0 %~ (fmap f . (<|> Just startCr))
|
||||
& cWorld . lWorld . creatures . at 0 ?~ f startCr
|
||||
|
||||
@@ -32,7 +32,7 @@ import Data.Foldable
|
||||
import Data.Monoid
|
||||
|
||||
testStringInit :: Universe -> [String]
|
||||
testStringInit _ = []
|
||||
testStringInit u = [show $ u^. uvWorld . wCam . camZoom]
|
||||
-- [show $ foldMap (foldMap (Sum . length . (^. seObstacles)))
|
||||
-- $ u ^. uvWorld . cWorld . incGraph]
|
||||
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . machines . ix 0 . mcType . _McProxSensor
|
||||
|
||||
Reference in New Issue
Block a user