More camera refactor
This commit is contained in:
@@ -22,9 +22,9 @@ targetSimpleDraw = targetDraw $ const activeTargetCursorPic
|
||||
targetDistanceDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||
targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
||||
p <- itm ^? itTargeting . tgPos . _Just
|
||||
let p1 = worldPosToScreen w p
|
||||
let p1 = worldPosToScreen cam p
|
||||
mwp = mouseWorldPos w
|
||||
p2 = worldPosToScreen w mwp
|
||||
p2 = worldPosToScreen cam mwp
|
||||
thecol = if dist p mwp > 100 then red else white
|
||||
return $
|
||||
winScale cfig $
|
||||
@@ -32,6 +32,8 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
||||
color thecol $
|
||||
line [p1, p2]
|
||||
<> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp)
|
||||
where
|
||||
cam = w ^. cWorld . lWorld . camPos
|
||||
|
||||
targetDraw :: (Item -> Picture) -> Item -> Creature -> Configuration -> World -> Picture
|
||||
targetDraw f it _ cfig w = fromMaybe mempty $ do
|
||||
@@ -40,8 +42,10 @@ targetDraw f it _ cfig w = fromMaybe mempty $ do
|
||||
winScale cfig $
|
||||
setLayer FixedCoordLayer $
|
||||
color white $
|
||||
uncurryV translate (worldPosToScreen w p) $
|
||||
uncurryV translate (worldPosToScreen cam p) $
|
||||
f it
|
||||
where
|
||||
cam = w ^. cWorld . lWorld . camPos
|
||||
|
||||
activeTargetCursorPic :: Picture
|
||||
activeTargetCursorPic =
|
||||
|
||||
Reference in New Issue
Block a user