Remove targeting bugs
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
module Dodge.Targeting.Draw where
|
||||
module Dodge.Targeting.Draw (
|
||||
drawTargeting,
|
||||
) where
|
||||
|
||||
import Data.Maybe
|
||||
import Dodge.Base
|
||||
@@ -13,12 +15,12 @@ drawTargeting :: TargetType -> Creature -> Configuration -> World -> Picture
|
||||
drawTargeting td = case td of
|
||||
TargetRBCreature -> targetRBCreatureDraw
|
||||
TargetRBLine -> targetDistanceDraw
|
||||
TargetLaser -> \_ _ _ -> mempty
|
||||
TargetLaser -> targetSimpleDraw
|
||||
TargetRBPress -> targetSimpleDraw
|
||||
TargetCursor -> targetSimpleDraw
|
||||
|
||||
targetSimpleDraw :: Creature -> Configuration -> World -> Picture
|
||||
targetSimpleDraw = targetDraw $ activeTargetCursorPic
|
||||
targetSimpleDraw = targetDraw activeTargetCursorPic
|
||||
|
||||
targetDistanceDraw :: Creature -> Configuration -> World -> Picture
|
||||
targetDistanceDraw cr cfig w = fromMaybe mempty $ do
|
||||
@@ -43,8 +45,7 @@ targetDraw f cr cfig w = fromMaybe mempty $ do
|
||||
winScale cfig $
|
||||
setLayer FixedCoordLayer $
|
||||
color white $
|
||||
uncurryV translate (worldPosToScreen cam p) $
|
||||
f
|
||||
uncurryV translate (worldPosToScreen cam p) f
|
||||
where
|
||||
cam = w ^. cWorld . camPos
|
||||
|
||||
@@ -66,20 +67,14 @@ targetRBCreatureDraw :: Creature -> Configuration -> World -> Picture
|
||||
targetRBCreatureDraw cr = targetDraw thepic cr
|
||||
where
|
||||
thepic
|
||||
| _ctActive $ _crTargeting $ cr = activeTargetCursorPic
|
||||
| _ctActive $ _crTargeting cr = activeTargetCursorPic
|
||||
| otherwise = targetCursorPic
|
||||
|
||||
targCorner :: Picture
|
||||
targCorner =
|
||||
pictures
|
||||
[ line [V2 x x, V2 x (x - y)]
|
||||
, line [V2 x x, V2 (x - y) x]
|
||||
]
|
||||
targCorner = line [V2 (x - y) x, V2 x x, V2 x (x - y)]
|
||||
where
|
||||
x = 10
|
||||
y = 5
|
||||
|
||||
targetCursorPic :: Picture
|
||||
targetCursorPic =
|
||||
pictures
|
||||
[rotate a targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
|
||||
targetCursorPic = pictures [rotate a targCorner | a <- [0, 0.5 * pi, pi, 1.5 * pi]]
|
||||
|
||||
Reference in New Issue
Block a user