Refactor window size, update selection cursor on new screen

This commit is contained in:
2023-03-25 09:27:27 +00:00
parent 20c05be23f
commit ea0c942887
57 changed files with 346 additions and 310 deletions
+8 -12
View File
@@ -23,31 +23,27 @@ targetSimpleDraw :: Creature -> Configuration -> World -> Picture
targetSimpleDraw = targetDraw activeTargetCursorPic
targetDistanceDraw :: Creature -> Configuration -> World -> Picture
targetDistanceDraw cr cfig w = fromMaybe mempty $ do
targetDistanceDraw cr _ w = fromMaybe mempty $ do
p <- cr ^? crTargeting . ctPos . _Just
let p1 = worldPosToScreen cam p
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
p2 = worldPosToScreen cam mwp
thecol = if dist p mwp > 100 then red else white
return $
winScale cfig $
return .
setLayer FixedCoordLayer $
color thecol $
line [p1, p2]
<> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp)
where
cam = w ^. cWorld . camPos
cam = w ^. cWorld . cwCamPos
targetDraw :: Picture -> Creature -> Configuration -> World -> Picture
targetDraw f cr cfig w = fromMaybe mempty $ do
targetDraw f cr _ _ = fromMaybe mempty $ do
p <- cr ^? crTargeting . ctPos . _Just
return $
winScale cfig $
setLayer FixedCoordLayer $
return .
setLayer DebugLayer $
color white $
uncurryV translate (worldPosToScreen cam p) f
where
cam = w ^. cWorld . camPos
uncurryV translate p f
activeTargetCursorPic :: Picture
activeTargetCursorPic =