Cleanup targeting
This commit is contained in:
@@ -9,19 +9,21 @@ import LensHelp
|
||||
import Picture
|
||||
import ShortShow
|
||||
|
||||
drawTargeting :: TargetDraw -> Item -> Creature -> Configuration -> World -> Picture
|
||||
drawTargeting :: TargetType -> Item -> Creature -> Configuration -> World -> Picture
|
||||
drawTargeting td = case td of
|
||||
NoTargetDraw -> \_ _ _ _ -> mempty
|
||||
SimpleDrawTarget -> targetSimpleDraw
|
||||
TargetRBCreatureDraw -> targetRBCreatureDraw
|
||||
TargetDistanceDraw -> targetDistanceDraw
|
||||
-- NoTargetDraw -> \_ _ _ _ -> mempty
|
||||
TargetRBCreature -> targetRBCreatureDraw
|
||||
TargetRBLine -> targetDistanceDraw
|
||||
TargetLaser -> \_ _ _ _ -> mempty
|
||||
TargetRBPress -> targetSimpleDraw
|
||||
TargetCursor -> targetSimpleDraw
|
||||
|
||||
targetSimpleDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||
targetSimpleDraw = targetDraw $ const activeTargetCursorPic
|
||||
|
||||
targetDistanceDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||
targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
||||
p <- itm ^? itTargeting . tgPos . _Just
|
||||
p <- itm ^? itUse . heldTargeting . tgPos . _Just
|
||||
let p1 = worldPosToScreen cam p
|
||||
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||
p2 = worldPosToScreen cam mwp
|
||||
@@ -37,7 +39,7 @@ targetDistanceDraw itm _ cfig w = fromMaybe mempty $ do
|
||||
|
||||
targetDraw :: (Item -> Picture) -> Item -> Creature -> Configuration -> World -> Picture
|
||||
targetDraw f it _ cfig w = fromMaybe mempty $ do
|
||||
p <- it ^? itTargeting . tgPos . _Just
|
||||
p <- it ^? itUse . heldTargeting . tgPos . _Just
|
||||
return $
|
||||
winScale cfig $
|
||||
setLayer FixedCoordLayer $
|
||||
@@ -65,7 +67,7 @@ targetRBCreatureDraw :: Item -> Creature -> Configuration -> World -> Picture
|
||||
targetRBCreatureDraw = targetDraw thepic
|
||||
where
|
||||
thepic it
|
||||
| _tgActive $ _itTargeting it = activeTargetCursorPic
|
||||
| _tgActive $ _heldTargeting $ _itUse it = activeTargetCursorPic
|
||||
| otherwise = targetCursorPic
|
||||
|
||||
targCorner :: Picture
|
||||
|
||||
Reference in New Issue
Block a user