Refactor window size, update selection cursor on new screen
This commit is contained in:
+11
-14
@@ -41,7 +41,7 @@ drawHUD cfig w = case w ^. hud . hudElement of
|
||||
<> drawSubInventory subinv cfig w
|
||||
|
||||
drawHP :: Configuration -> World -> Picture
|
||||
drawHP cfig w = winScale cfig . dShadCol white $ displayHP 0 cfig w
|
||||
drawHP cfig w = dShadCol white $ displayHP 0 cfig w
|
||||
|
||||
|
||||
drawInventory :: SelectionSections () -> World -> Configuration -> Picture
|
||||
@@ -265,7 +265,7 @@ eqPosText ep = case ep of
|
||||
OnSpecial -> "EQUIPPED"
|
||||
|
||||
combineCounts :: Configuration -> World -> [Int] -> Picture
|
||||
combineCounts cfig w = winScale cfig . foldMap f . group
|
||||
combineCounts cfig w = foldMap f . group
|
||||
where
|
||||
f (i : is) = fromMaybe mempty $ do
|
||||
_ <- yourInv w ^? ix i . itUse . useAmount
|
||||
@@ -277,8 +277,7 @@ combineCounts cfig w = winScale cfig . foldMap f . group
|
||||
|
||||
lnkMidPosInvSelsCol :: Configuration -> World -> Int -> Color -> [Int] -> Picture
|
||||
lnkMidPosInvSelsCol cfig w i col =
|
||||
winScale cfig
|
||||
. foldMap f
|
||||
foldMap f
|
||||
where
|
||||
f j = fromMaybe mempty $ do
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
@@ -302,8 +301,7 @@ tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp
|
||||
|
||||
invHead :: Configuration -> String -> Picture
|
||||
invHead cfig =
|
||||
winScale cfig
|
||||
. translate (- halfWidth cfig + subInvX + 20) (halfHeight cfig - 40)
|
||||
translate (- halfWidth cfig + subInvX + 20) (halfHeight cfig - 40)
|
||||
. dShadCol white
|
||||
. scale 0.4 0.4
|
||||
. text
|
||||
@@ -314,7 +312,7 @@ drawCarte cfig w =
|
||||
renderListAt 0 0 cfig locs :
|
||||
-- zipWith bConnect (displayListEndCoords cfig locTexts) locPoss
|
||||
-- ++
|
||||
mapOverlay cfig w
|
||||
mapOverlay w
|
||||
++ [mainListCursor white iPos cfig]
|
||||
where
|
||||
iPos = w ^. cWorld . lWorld . selLocation
|
||||
@@ -330,17 +328,17 @@ drawCarte cfig w =
|
||||
-- h :: String -> Point2 -> Point2
|
||||
-- h s (V2 x y) = V2 (x + 9 * fromIntegral (length s)) y
|
||||
|
||||
mapOverlay :: Configuration -> World -> [Picture]
|
||||
mapOverlay cfig w =
|
||||
mapOverlay :: World -> [Picture]
|
||||
mapOverlay w =
|
||||
(color (withAlpha 0.5 black) . polygon $ reverse $ rectNSWE 1 (-1) 1 (-1)) :
|
||||
[foldMap (drawMapWall cfig (w ^. hud)) $ IM.restrictKeys (lw ^. walls) (w ^. cWorld . seenWalls)]
|
||||
[foldMap (drawMapWall (w ^. hud)) $ IM.restrictKeys (lw ^. walls) (w ^. cWorld . seenWalls)]
|
||||
where
|
||||
--(mapMaybe (mapWall cfig (w ^. hud)) . IM.elems $ w ^. cWorld . lWorld . walls)
|
||||
|
||||
lw = w ^. cWorld . lWorld
|
||||
|
||||
drawMapWall :: Configuration -> HUD -> Wall -> Picture
|
||||
drawMapWall cfig thehud wl = color c . polygon $ map (cartePosToScreen cfig thehud) [x, x +.+ n2, y +.+ n2, y]
|
||||
drawMapWall :: HUD -> Wall -> Picture
|
||||
drawMapWall thehud wl = color c . polygon $ map (cartePosToScreen thehud) [x, x +.+ n2, y +.+ n2, y]
|
||||
where
|
||||
t = normalizeV (y -.- x)
|
||||
n2 = 20 *.* vNormal t
|
||||
@@ -420,8 +418,7 @@ openCursorAt ::
|
||||
Configuration ->
|
||||
Picture
|
||||
openCursorAt wth col xoff yoff yint w =
|
||||
winScale w
|
||||
. translate (xoff - halfWidth w) (halfHeight w - (20 * fromIntegral yint + yoff) - 20)
|
||||
translate (xoff - halfWidth w) (halfHeight w - (20 * fromIntegral yint + yoff) - 20)
|
||||
$ lineCol
|
||||
[ (V2 wth 12.5, withAlpha 0 col)
|
||||
, (V2 0 12.5, col)
|
||||
|
||||
@@ -14,7 +14,7 @@ import Picture
|
||||
renderInfoListAt :: Float -> Float -> Configuration -> CamPos -> (Point2, [String]) -> Picture
|
||||
renderInfoListAt x y cfig cam (p, ss) =
|
||||
renderListAt x y cfig (zip ss (repeat white))
|
||||
<> winScale cfig (color white $ lConnect (V2 (x - hw) (hh -25 - y)) (worldPosToScreen cam p))
|
||||
<> color white (lConnect (V2 (x - hw) (hh -25 - y)) (worldPosToScreen cam p))
|
||||
<> listCursorNSW x y cfig 0 0 white 19 (length ss)
|
||||
where
|
||||
hw = halfWidth cfig
|
||||
|
||||
+12
-15
@@ -1,25 +1,22 @@
|
||||
module Dodge.Render.Label
|
||||
where
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.ShortShow
|
||||
import Dodge.Base.WinScale
|
||||
import Picture
|
||||
module Dodge.Render.Label where
|
||||
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.ShortShow
|
||||
import Geometry
|
||||
import Picture
|
||||
|
||||
drawLabCrossCol :: Configuration -> CamPos -> Color -> Point2 -> Picture
|
||||
drawLabCrossCol cfig w col p = drawCrossCol col p
|
||||
<> drawPointLabel cfig w p
|
||||
drawLabCrossCol :: Color -> Point2 -> Picture
|
||||
drawLabCrossCol col p =
|
||||
drawCrossCol col p
|
||||
<> drawPointLabel p
|
||||
|
||||
drawPointLabel :: Configuration -> CamPos -> Point2 -> Picture
|
||||
drawPointLabel cfig w p =
|
||||
setLayer FixedCoordLayer . winScale cfig
|
||||
. uncurryV translate p'
|
||||
drawPointLabel :: Point2 -> Picture
|
||||
drawPointLabel p =
|
||||
setLayer DebugLayer
|
||||
. uncurryV translate p
|
||||
. scale 0.1 0.1
|
||||
. text
|
||||
$ shortPoint2 p
|
||||
where
|
||||
p' = worldPosToScreen w p
|
||||
|
||||
drawCrossCol :: Color -> Point2 -> Picture
|
||||
drawCrossCol col p = setLayer DebugLayer . color col . uncurryV translate p $ crossPic 5
|
||||
|
||||
+16
-19
@@ -1,19 +1,20 @@
|
||||
module Dodge.Render.List where
|
||||
|
||||
--import Picture.Text
|
||||
import Dodge.Inventory
|
||||
|
||||
--import Data.Foldable
|
||||
import Dodge.SelectionList
|
||||
|
||||
import Data.Maybe
|
||||
import Dodge.Base.WinScale
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Inventory
|
||||
import Dodge.SelectionList
|
||||
import Geometry
|
||||
import LensHelp
|
||||
import ListHelp
|
||||
import Picture
|
||||
import LensHelp
|
||||
|
||||
drawSelectionList :: ListDisplayParams -> Configuration -> SelectionList a -> Picture
|
||||
drawSelectionList ldps cfig sl =
|
||||
@@ -31,7 +32,8 @@ makeSelectionListPictures :: SelectionList a -> [Picture]
|
||||
makeSelectionListPictures sl = concatMap f $ getShownItems sl
|
||||
where
|
||||
f si = map (color (_siColor si) . text) $ _siPictures si
|
||||
--f si = map (textGrad (_siColor si) (withAlpha 0 (_siColor si))) $ _siPictures si
|
||||
|
||||
--f si = map (textGrad (_siColor si) (withAlpha 0 (_siColor si))) $ _siPictures si
|
||||
|
||||
drawCursorAt :: ListDisplayParams -> Configuration -> Maybe Int -> [SelectionItem a] -> Picture
|
||||
drawCursorAt ldps cfig mi lis = fromMaybe mempty $ do
|
||||
@@ -55,7 +57,7 @@ drawSelectionCursor ldps cfig sl = drawCursorAt ldps cfig (f $ sl ^. slSelPos) (
|
||||
f = case sl ^. slRegex of
|
||||
_ | sl ^. slRegexInput -> const (Just 0)
|
||||
"" | not (sl ^. slRegexInput) -> id
|
||||
_ -> fmap (+1)
|
||||
_ -> fmap (+ 1)
|
||||
|
||||
-- given a list of pictures that are each the size of a "text" call, displays them as
|
||||
-- a list on the screen
|
||||
@@ -81,7 +83,7 @@ selSecDrawCursor xsize borders cfig ldp sss i j = fromMaybe mempty $ do
|
||||
si <- sss ^? sssSections . ix i . ssItems . ix j
|
||||
return $ listCursorDisplayParams ldp borders cfig yint xint (_siColor si) xsize (length $ _siPictures si)
|
||||
|
||||
listCursorDisplayParams ::
|
||||
listCursorDisplayParams ::
|
||||
ListDisplayParams ->
|
||||
[CardinalPoint] ->
|
||||
Configuration ->
|
||||
@@ -116,10 +118,9 @@ listCursorChooseBorderScale ::
|
||||
Int ->
|
||||
Picture
|
||||
listCursorChooseBorderScale ygap s borders xoff yoff cfig yint xint col cursxsize cursysize =
|
||||
winScale cfig
|
||||
. translate
|
||||
(15 + (9 * s * (fromIntegral xint - 1)) + xoff - halfWidth cfig)
|
||||
(halfHeight cfig + s * 12.5 - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||
translate
|
||||
(15 + (9 * s * (fromIntegral xint - 1)) + xoff - halfWidth cfig)
|
||||
(halfHeight cfig + s * 12.5 - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||
. color col
|
||||
$ chooseCursorBorders (s * wth) (s * hgt) borders
|
||||
where
|
||||
@@ -160,8 +161,7 @@ listCursorNSW = listCursorChooseBorder [North, South, West]
|
||||
|
||||
fillScreenText :: Configuration -> String -> Picture
|
||||
fillScreenText cfig str =
|
||||
winScale cfig
|
||||
. scale wscale hscale
|
||||
scale wscale hscale
|
||||
. centerText
|
||||
$ str
|
||||
where
|
||||
@@ -172,8 +172,7 @@ fillScreenText cfig str =
|
||||
|
||||
fillWidthText :: Configuration -> String -> Picture
|
||||
fillWidthText cfig str =
|
||||
winScale cfig
|
||||
. scale thescale thescale
|
||||
scale thescale thescale
|
||||
. centerText
|
||||
$ str
|
||||
where
|
||||
@@ -182,8 +181,7 @@ fillWidthText cfig str =
|
||||
|
||||
listTextPictureAt :: Float -> Float -> Configuration -> Int -> Picture -> Picture
|
||||
listTextPictureAt xoff yoff cfig yint =
|
||||
winScale cfig
|
||||
. translate (xoff + 15 - hw) (negate yoff + hh - (20 * (fromIntegral yint + 1)))
|
||||
translate (xoff + 15 - hw) (negate yoff + hh - (20 * (fromIntegral yint + 1)))
|
||||
. scale 0.1 0.1
|
||||
where
|
||||
hw = halfWidth cfig
|
||||
@@ -191,8 +189,7 @@ listTextPictureAt xoff yoff cfig yint =
|
||||
|
||||
listTextPictureAtScale :: Float -> Float -> Float -> Float -> Configuration -> Int -> Picture -> Picture
|
||||
listTextPictureAtScale ygap s xoff yoff cfig yint =
|
||||
winScale cfig
|
||||
. translate (xoff + 15 - hw) (negate yoff + hh - ((s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||
translate (xoff + 15 - hw) (negate yoff + hh - ((s * 10 + ygap) * (fromIntegral yint + 1)))
|
||||
. scale (s * 0.1) (s * 0.1)
|
||||
where
|
||||
hw = halfWidth cfig
|
||||
|
||||
@@ -3,7 +3,6 @@ module Dodge.Render.MenuScreen (
|
||||
drawMenuScreen,
|
||||
) where
|
||||
|
||||
import Dodge.Base.WinScale
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Render.List
|
||||
import Dodge.Base.Window
|
||||
@@ -46,10 +45,10 @@ drawOptions ldps cfig title sl =
|
||||
]
|
||||
|
||||
darkenBackground :: Configuration -> Picture
|
||||
darkenBackground cfig = winScale cfig . color (withAlpha 0.5 black) . polygon . reverse . screenBox $ cfig
|
||||
darkenBackground = color (withAlpha 0.5 black) . polygon . reverse . screenBox
|
||||
|
||||
drawTitle :: Configuration -> String -> Picture
|
||||
drawTitle cfig = winScale cfig . translate (30 - hw) (hh-50) . scale 0.4 0.4 . text
|
||||
drawTitle cfig = translate (30 - hw) (hh-50) . scale 0.4 0.4 . text
|
||||
where
|
||||
hh = halfHeight cfig
|
||||
hw = halfWidth cfig
|
||||
|
||||
+39
-18
@@ -3,32 +3,36 @@ module Dodge.Render.Picture (
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Dodge.Base.WinScale
|
||||
import Data.Maybe
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Base.Window
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Render.HUD
|
||||
import Dodge.Render.List
|
||||
import Dodge.Render.MenuScreen
|
||||
import Geometry
|
||||
import HelpNum
|
||||
import Picture
|
||||
|
||||
fixedCoordPictures :: Universe -> Picture
|
||||
fixedCoordPictures u = drawMenuOrHUD cfig u
|
||||
<> drawConcurrentMessage u
|
||||
<> customMouseCursor cfig (u ^. uvWorld . input)
|
||||
<> listPicturesAt (halfWidth cfig) 0 cfig (map text (_uvTestString u u))
|
||||
<> displayFrameTicks u
|
||||
fixedCoordPictures u =
|
||||
drawMenuOrHUD cfig u
|
||||
<> drawConcurrentMessage u
|
||||
<> customMouseCursor u
|
||||
<> listPicturesAt (halfWidth cfig) 0 cfig (map text (_uvTestString u u))
|
||||
<> displayFrameTicks u
|
||||
where
|
||||
cfig = _uvConfig u
|
||||
|
||||
displayFrameTicks :: Universe -> Picture
|
||||
displayFrameTicks u = if (debugOn Show_ms_frame $ _uvConfig u) then
|
||||
( setDepth (-1)
|
||||
. translate (-0.5) (-0.8)
|
||||
. scale 0.0005 0.0005
|
||||
displayFrameTicks u =
|
||||
if debugOn Show_ms_frame $ _uvConfig u
|
||||
then
|
||||
setDepth (-1)
|
||||
. translate (-10) (- halfHeight (_uvConfig u) + 6)
|
||||
. scale 0.2 0.2
|
||||
$ fpsText (u ^. uvFrameTicks - u ^. uvLastFrameTicks)
|
||||
)
|
||||
else mempty
|
||||
else mempty
|
||||
|
||||
fpsText :: (Show a, Ord a, Num a) => a -> Picture
|
||||
fpsText x = color col $ text $ "ms/frame " ++ show x
|
||||
@@ -49,7 +53,7 @@ drawConcurrentMessage :: Universe -> Picture
|
||||
drawConcurrentMessage u =
|
||||
stackPicturesAt
|
||||
(halfWidth cfig)
|
||||
(_windowY cfig - 50)
|
||||
(windowYFloat cfig - 50)
|
||||
cfig
|
||||
(map (centerText . f) $ u ^.. uvSideEffects . each)
|
||||
where
|
||||
@@ -57,9 +61,26 @@ drawConcurrentMessage u =
|
||||
f (RunningSideEffect ce) = ce ++ " IN PROGRESS"
|
||||
f x = _ceString x ++ " QUEUED"
|
||||
|
||||
customMouseCursor :: Configuration -> Input -> Picture
|
||||
customMouseCursor cfig inp =
|
||||
winScale cfig
|
||||
. uncurryV translate (_mousePos inp)
|
||||
customMouseCursor :: Universe -> Picture
|
||||
customMouseCursor u =
|
||||
uncurryV translate (u ^. uvWorld . input . mousePos)
|
||||
. color white
|
||||
$ pictures [line [V2 (-5) 0, V2 5 0], line [V2 0 (-5), V2 0 5]]
|
||||
$ mouseCursorType u
|
||||
|
||||
mouseCursorType :: Universe -> Picture
|
||||
mouseCursorType u
|
||||
| null (u ^. uvScreenLayers) = rotate a (drawPlus 5)
|
||||
| otherwise = mousePlus
|
||||
where
|
||||
w = u ^. uvWorld
|
||||
a = fromMaybe 0 $ do
|
||||
cpos <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
|
||||
return . toClosestMultiple (pi / 32) $
|
||||
argV (mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos) -.- cpos)
|
||||
- w ^. cWorld . cwCamPos . camRot
|
||||
|
||||
mousePlus :: Picture
|
||||
mousePlus = pictures [line [V2 (-5) 0, V2 5 0], line [V2 0 (-5), V2 0 5]]
|
||||
|
||||
drawPlus :: Float -> Picture
|
||||
drawPlus x = pictures [line [V2 (- x) 0, V2 x 0], line [V2 0 (- x), V2 0 x]]
|
||||
|
||||
@@ -53,7 +53,7 @@ worldSPic cfig u =
|
||||
<> foldup floorItemSPic (filtOn _flItPos _floorItems)
|
||||
<> foldup btSPic (filtOn _btPos _buttons)
|
||||
<> foldup mcSPic (filtOn _mcPos _machines)
|
||||
<> aimDelaySweep cfig w
|
||||
<> aimDelaySweep w
|
||||
<> anyTargeting cfig w
|
||||
where
|
||||
w = _uvWorld u
|
||||
@@ -61,22 +61,21 @@ worldSPic cfig u =
|
||||
filtOn f g = IM.filter (pointIsClose . f) (g (_lWorld (_cWorld w)))
|
||||
pointIsClose = cullPoint cfig w
|
||||
|
||||
aimDelaySweep :: Configuration -> World -> SPic
|
||||
aimDelaySweep cfig w = fromMaybe mempty $ do
|
||||
aimDelaySweep :: World -> SPic
|
||||
aimDelaySweep w = fromMaybe mempty $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
aimstatus <- cr ^? crStance . posture
|
||||
guard (aimstatus == Aiming)
|
||||
return $ noShape $ drawSweep cr cfig w
|
||||
return $ noShape $ drawSweep cr w
|
||||
|
||||
drawSweep :: Creature -> Configuration -> World -> Picture
|
||||
drawSweep cr cfig w = fromMaybe mempty $ do
|
||||
drawSweep :: Creature -> World -> Picture
|
||||
drawSweep cr w = fromMaybe mempty $ do
|
||||
a <- safeArgV (mwp -.- p)
|
||||
let a'
|
||||
| a - cdir > pi = cdir + 2 * pi
|
||||
| a - cdir < - pi = cdir - 2 * pi
|
||||
| otherwise = cdir
|
||||
return $
|
||||
winScale cfig $
|
||||
setLayer FixedCoordLayer $
|
||||
uncurryV translate (worldPosToScreen campos p) $
|
||||
arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
|
||||
@@ -84,7 +83,7 @@ drawSweep cr cfig w = fromMaybe mempty $ do
|
||||
cdir = _crDir cr
|
||||
rot = campos ^. camRot
|
||||
p = _crPos cr
|
||||
campos = w ^. cWorld . camPos
|
||||
campos = w ^. cWorld . cwCamPos
|
||||
theinput = w ^. input
|
||||
mwp = mouseWorldPos theinput campos
|
||||
|
||||
@@ -135,8 +134,8 @@ shiftDraw' fpos fdir fdraw x =
|
||||
|
||||
cullPoint :: Configuration -> World -> Point2 -> Bool
|
||||
cullPoint cfig w p
|
||||
| debugOn Close_shape_culling cfig = pointInPolygon p (w ^. cWorld . camPos . camBoundBox)
|
||||
| otherwise = dist (w ^. cWorld . camPos . camCenter) p < (w ^. cWorld . camPos . camViewDistance)
|
||||
| debugOn Close_shape_culling cfig = pointInPolygon p (w ^. cWorld . cwCamPos . camBoundBox)
|
||||
| otherwise = dist (w ^. cWorld . cwCamPos . camCenter) p < (w ^. cWorld . cwCamPos . camViewDistance)
|
||||
|
||||
extraPics :: Configuration -> Universe -> Picture
|
||||
extraPics cfig u =
|
||||
@@ -199,24 +198,23 @@ debugDraw' cfig w bl = case bl of
|
||||
Cr_awareness -> drawCreatureDisplayTexts w
|
||||
Show_sound -> pictures $ M.map (soundPic cfig w) $ _playingSounds w
|
||||
Cr_status -> drawCrInfo cfig (w ^. cWorld)
|
||||
Mouse_position -> drawMousePosition cfig w
|
||||
Walls_info -> drawWlIDs cfig w
|
||||
Mouse_position -> drawMousePosition w
|
||||
Walls_info -> drawWlIDs w
|
||||
Pathing -> drawPathing cfig w
|
||||
Show_nodes_near_select -> undefined --drawNodesNearSelect w
|
||||
Show_path_between -> drawPathBetween w
|
||||
Collision_test -> drawCollisionTest cfig w
|
||||
Collision_test -> drawCollisionTest w
|
||||
|
||||
drawCollisionTest :: Configuration -> World -> Picture
|
||||
drawCollisionTest cfig w =
|
||||
drawCollisionTest :: World -> Picture
|
||||
drawCollisionTest w =
|
||||
setLayer DebugLayer (color orange $ line [a, b])
|
||||
<> foldMap (drawCross . fst) (crHit a b w)
|
||||
<> foldMap (drawCross . _crPos) (crsNearSeg a b w)
|
||||
<> foldMap (drawZoneCol green crZoneSize . zoneOfPoint crZoneSize) (xIntercepts crZoneSize a b)
|
||||
<> foldMap (drawZoneCol yellow crZoneSize . zoneOfPoint crZoneSize) (yIntercepts' crZoneSize a b)
|
||||
<> foldMap (drawLabCrossCol cfig cam blue) (xIntercepts crZoneSize a b)
|
||||
<> foldMap (drawLabCrossCol blue) (xIntercepts crZoneSize a b)
|
||||
where
|
||||
(a, b) = _lrLine (_input w)
|
||||
cam = w ^. cWorld . camPos
|
||||
|
||||
drawCreatureDisplayTexts :: World -> Picture
|
||||
drawCreatureDisplayTexts w = foldMap (creatureDisplayText w) (w ^. cWorld . lWorld . creatures)
|
||||
@@ -245,7 +243,7 @@ drawWallsNearYou w = fromMaybe mempty $ do
|
||||
|
||||
drawWallsNearCursor :: World -> Picture
|
||||
drawWallsNearCursor w =
|
||||
setLayer DebugLayer $ foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_camPos $ _cWorld w)) w
|
||||
setLayer DebugLayer $ foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_cwCamPos $ _cWorld w)) w
|
||||
where
|
||||
f wl = color rose $ thickLine 3 [a, b]
|
||||
where
|
||||
@@ -309,13 +307,13 @@ drawFarWallDetect w =
|
||||
)
|
||||
$ getViewpoints p (_cWorld w)
|
||||
where
|
||||
p = w ^. cWorld . camPos . camViewFrom
|
||||
p = w ^. cWorld . cwCamPos . camViewFrom
|
||||
|
||||
drawZoneNearPointCursor :: World -> Picture
|
||||
drawZoneNearPointCursor w =
|
||||
foldMap (drawZoneCol orange 50) ps
|
||||
where
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
||||
ps = [zoneOfPoint 50 mwp]
|
||||
|
||||
drawDDATest :: World -> Picture
|
||||
@@ -323,8 +321,8 @@ drawDDATest w =
|
||||
foldMap (drawZoneCol orange 50) ps
|
||||
<> setLayer DebugLayer (color yellow (line [cvf, mwp]))
|
||||
where
|
||||
cvf = w ^. cWorld . camPos . camViewFrom
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||
cvf = w ^. cWorld . cwCamPos . camViewFrom
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
||||
ps = zoneOfSeg 50 cvf mwp
|
||||
|
||||
drawZoneCol :: Color -> Float -> V2 Int -> Picture
|
||||
@@ -344,7 +342,7 @@ drawWallSearchRays w = foldMap (f . fst) $ allVisibleWalls w
|
||||
setLayer DebugLayer $
|
||||
color yellow $
|
||||
uncurryV translate p (circle 5)
|
||||
<> line [w ^. cWorld . camPos . camViewFrom, p]
|
||||
<> line [w ^. cWorld . cwCamPos . camViewFrom, p]
|
||||
|
||||
testPic :: Configuration -> World -> Picture
|
||||
testPic _ _ = mempty
|
||||
@@ -352,7 +350,7 @@ testPic _ _ = mempty
|
||||
drawBoundingBox :: World -> Picture
|
||||
drawBoundingBox w = setLayer DebugLayer $ color green $ line $ (x : xs) ++ [x]
|
||||
where
|
||||
(x : xs) = w ^. cWorld . camPos . camBoundBox
|
||||
(x : xs) = w ^. cWorld . cwCamPos . camBoundBox
|
||||
|
||||
ppDraw :: PressPlate -> Picture
|
||||
ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c)
|
||||
@@ -377,7 +375,7 @@ soundPic cfig w s = fixedSizePicClampArrow 50 50 thePic p cfig (w ^. cWorld)
|
||||
where
|
||||
p = _soundPos s
|
||||
thePic =
|
||||
rotate (w ^. cWorld . camPos . camRot)
|
||||
rotate (w ^. cWorld . cwCamPos . camRot)
|
||||
. scale theScale theScale
|
||||
. centerText
|
||||
. soundToOnomato
|
||||
@@ -385,31 +383,28 @@ soundPic cfig w s = fixedSizePicClampArrow 50 50 thePic p cfig (w ^. cWorld)
|
||||
theScale = 0.15 * f (_soundVolume s * 0.0001)
|
||||
f x = 1 - 0.5 * (1 - x)
|
||||
|
||||
drawMousePosition :: Configuration -> World -> Picture
|
||||
drawMousePosition cfig w =
|
||||
drawMousePosition :: World -> Picture
|
||||
drawMousePosition w =
|
||||
setLayer FixedCoordLayer
|
||||
. winScale cfig
|
||||
. uncurryV translate p
|
||||
. uncurryV translate (w ^. input . mousePos)
|
||||
. scale 0.1 0.1
|
||||
. text
|
||||
$ shortPoint2 mwp
|
||||
where
|
||||
p = worldPosToScreen (w ^. cWorld . camPos) mwp
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
||||
|
||||
drawWlIDs :: Configuration -> World -> Picture
|
||||
drawWlIDs cfig w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls)
|
||||
drawWlIDs :: World -> Picture
|
||||
drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls)
|
||||
where
|
||||
f wl
|
||||
| dist (_crPos $ you w) (fst (_wlLine wl)) > 200 = mempty -- this should be improved with a better "on screen test"
|
||||
| otherwise =
|
||||
winScale cfig
|
||||
. uncurryV translate p
|
||||
uncurryV translate p
|
||||
. scale 0.1 0.1
|
||||
. text
|
||||
$ show $ _wlID wl
|
||||
where
|
||||
p = worldPosToScreen (w ^. cWorld . camPos) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||
p = worldPosToScreen (w ^. cWorld . cwCamPos) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||
|
||||
edgeToPic :: [Point2] -> PathEdge -> Picture
|
||||
edgeToPic poly pe
|
||||
@@ -422,7 +417,7 @@ edgeToPic poly pe
|
||||
drawPathing :: Configuration -> World -> Picture
|
||||
drawPathing cfig w =
|
||||
setLayer DebugLayer $
|
||||
foldMap (edgeToPic (screenPolygon cfig (w ^. cWorld . camPos)) . (^?! _3)) (FGL.labEdges gr)
|
||||
foldMap (edgeToPic (screenPolygon cfig (w ^. cWorld . cwCamPos)) . (^?! _3)) (FGL.labEdges gr)
|
||||
<> foldMap dispInc (graphToIncidence gr)
|
||||
where
|
||||
dispInc (p, n) = setDepth 2 . uncurryV translate p . scale 0.1 0.1 $ text $ show n
|
||||
@@ -459,7 +454,7 @@ drawCrInfo cfig w =
|
||||
renderInfoListsAt (2 * hw - 400) 0 cfig cam $
|
||||
mapMaybe (crDisplayInfo cfig cam) $ IM.elems $ w ^. lWorld . creatures
|
||||
where
|
||||
cam = w ^. camPos
|
||||
cam = w ^. cwCamPos
|
||||
hw = halfWidth cfig
|
||||
|
||||
viewBoundaries :: CWorld -> Picture
|
||||
@@ -468,7 +463,7 @@ viewBoundaries w =
|
||||
color green (foldMap (polygonWire . _grBound) grs)
|
||||
<> color yellow (foldMap (\q -> line [p, q]) $ getViewpoints p w)
|
||||
where
|
||||
p = w ^. camPos . camViewFrom
|
||||
p = w ^. cwCamPos . camViewFrom
|
||||
grs = filter (pointInOrOnPolygon p . _grBound) (_cwgGameRooms $ _cwGen w)
|
||||
|
||||
viewClipBounds :: Configuration -> World -> Picture
|
||||
|
||||
Reference in New Issue
Block a user