Draw cursor when targeting with HUD
This commit is contained in:
+14
-44
@@ -2,8 +2,9 @@ module Dodge.Targeting.Draw (
|
||||
drawTargeting,
|
||||
) where
|
||||
|
||||
--import Data.Maybe
|
||||
--import Dodge.Base
|
||||
import Dodge.Base.Coordinate
|
||||
import Data.Maybe
|
||||
import Control.Lens
|
||||
import Dodge.Data.Universe
|
||||
import Geometry.Data
|
||||
--import Geometry.Vector
|
||||
@@ -11,40 +12,17 @@ import Geometry.Data
|
||||
import Picture
|
||||
--import ShortShow
|
||||
|
||||
drawTargeting :: TargetingType -> Creature -> Configuration -> World -> Picture
|
||||
drawTargeting td = case td of
|
||||
TargetRBCreature -> targetRBCreatureDraw
|
||||
TARGETLASER -> targetSimpleDraw
|
||||
TargetRBPress -> targetSimpleDraw
|
||||
TargetCursor -> targetSimpleDraw
|
||||
|
||||
targetSimpleDraw :: Creature -> Configuration -> World -> Picture
|
||||
targetSimpleDraw = targetDraw activeTargetCursorPic
|
||||
|
||||
--targetDistanceDraw cr _ w = mempty
|
||||
-- fromMaybe mempty $ do
|
||||
-- p <- cr ^? crTargeting . ctPos . _Just
|
||||
-- let p1 = worldPosToScreen cam p
|
||||
-- mwp = mouseWorldPos (w ^. input) (w ^. wCam)
|
||||
-- p2 = worldPosToScreen cam mwp
|
||||
-- thecol = if dist p mwp > 100 then red else white
|
||||
-- return .
|
||||
-- setLayer FixedCoordLayer $
|
||||
-- color thecol $
|
||||
-- line [p1, p2]
|
||||
-- <> transMidLine p1 p2 (scale 0.1 0.1 . text . shortShow $ dist p mwp)
|
||||
-- where
|
||||
-- cam = w ^. wCam
|
||||
|
||||
targetDraw :: Picture -> Creature -> Configuration -> World -> Picture
|
||||
targetDraw _ _ _ _ = mempty
|
||||
--targetDraw f cr _ _ = mempty
|
||||
-- fromMaybe mempty $ do
|
||||
-- p <- cr ^? crTargeting . ctPos . _Just
|
||||
-- return .
|
||||
-- setLayer DebugLayer $
|
||||
-- color white $
|
||||
-- uncurryV translate p f
|
||||
-- it would be nice to get rid of some redundant checks here
|
||||
drawTargeting :: Item -> World -> Picture
|
||||
drawTargeting itm w = fromMaybe mempty $ do
|
||||
p <- itm ^? itUse . tgPos . _Just
|
||||
let thepic = case itm ^? itUse . tgActive of
|
||||
Just True -> activeTargetCursorPic
|
||||
_ -> targetCursorPic
|
||||
return .
|
||||
setLayer FixedCoordLayer $
|
||||
color white $
|
||||
uncurryV translate (worldPosToScreen (w ^. wCam) p) thepic
|
||||
|
||||
activeTargetCursorPic :: Picture
|
||||
activeTargetCursorPic =
|
||||
@@ -60,14 +38,6 @@ activeTargetCursorPic =
|
||||
-- | x > x' = min 10 (x - x')
|
||||
-- | otherwise = max (-10) (x - x')
|
||||
|
||||
targetRBCreatureDraw :: Creature -> Configuration -> World -> Picture
|
||||
targetRBCreatureDraw cr = targetDraw targetCursorPic cr
|
||||
--targetRBCreatureDraw cr = targetDraw thepic cr
|
||||
-- where
|
||||
-- thepic
|
||||
-- | _ctActive $ _crTargeting cr = activeTargetCursorPic
|
||||
-- | otherwise = targetCursorPic
|
||||
|
||||
targCorner :: Picture
|
||||
targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)]
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user