Cleanup, fix broken records in LeftUse

This commit is contained in:
2024-10-03 10:34:17 +01:00
parent e88b3c7443
commit 1953fb2d0c
19 changed files with 71 additions and 114 deletions
+7 -20
View File
@@ -2,15 +2,12 @@ module Dodge.Targeting.Draw (
drawTargeting,
) where
import Dodge.Base.Coordinate
import Data.Maybe
import Control.Lens
import Data.Maybe
import Dodge.Base.Coordinate
import Dodge.Data.Universe
import Geometry.Data
--import Geometry.Vector
--import LensHelp
import Picture
--import ShortShow
-- it would be nice to get rid of some redundant checks here
drawTargeting :: Item -> World -> Picture
@@ -19,24 +16,14 @@ drawTargeting itm w = fromMaybe mempty $ do
let thepic = case itm ^? itUse . tgActive of
Just True -> activeTargetCursorPic
_ -> targetCursorPic
return .
setLayer FixedCoordLayer $
color white $
uncurryV translate (worldPosToScreen (w ^. wCam) p) thepic
return
. setLayer FixedCoordLayer
. color white
$ uncurryV translate (worldPosToScreen (w ^. wCam) p) thepic
activeTargetCursorPic :: Picture
activeTargetCursorPic =
fold
[rotate a $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
--transMidLine :: Point2 -> Point2 -> Picture -> Picture
--transMidLine p1 p2 = translate 20 (f p1 p2) . uncurryV translate (0.5 *.* (p1 +.+ p2))
-- where
-- f (V2 x y) (V2 x' y')
-- | y > y' && x > x' = max (-10) (x' - x)
-- | y > y' && x < x' = min 10 (x' - x)
-- | x > x' = min 10 (x - x')
-- | otherwise = max (-10) (x - x')
fold [rotate (a * pi) $ line [V2 15 0, V2 10 0] <> targCorner | a <- [0, 0.5, 1, 1.5]]
targCorner :: Picture
targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)]