Improve simple aiming sweep
This commit is contained in:
@@ -7,7 +7,7 @@ import Dodge.Viewpoints
|
|||||||
import Dodge.Render.Label
|
import Dodge.Render.Label
|
||||||
import Dodge.WorldEvent.ThingsHit
|
import Dodge.WorldEvent.ThingsHit
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
--import Control.Monad (guard)
|
import Control.Monad (guard)
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import qualified Data.Graph.Inductive as FGL
|
import qualified Data.Graph.Inductive as FGL
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
@@ -65,35 +65,27 @@ worldSPic cfig w =
|
|||||||
aimDelaySweep :: Configuration -> World -> SPic
|
aimDelaySweep :: Configuration -> World -> SPic
|
||||||
aimDelaySweep cfig w = fromMaybe mempty $ do
|
aimDelaySweep cfig w = fromMaybe mempty $ do
|
||||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||||
-- aimstatus <- cr ^? crStance . posture
|
aimstatus <- cr ^? crStance . posture
|
||||||
-- guard (aimstatus == Aiming)
|
guard (aimstatus == Aiming)
|
||||||
return $ noShape $ drawSweep cr cfig w
|
return $ noShape $ drawSweep cr cfig w
|
||||||
|
|
||||||
drawSweep :: Creature -> Configuration -> World -> Picture
|
drawSweep :: Creature -> Configuration -> World -> Picture
|
||||||
drawSweep cr cfig w = fromMaybe mempty $ do
|
drawSweep cr cfig w = fromMaybe mempty $ do
|
||||||
--a <- safeArgV (mwp -.- p)
|
a <- safeArgV (mwp -.- p)
|
||||||
|
let a' | a - cdir > pi = cdir + 2* pi
|
||||||
|
| a - cdir < - pi = cdir - 2* pi
|
||||||
|
| otherwise = cdir
|
||||||
return $ winScale cfig
|
return $ winScale cfig
|
||||||
$ setLayer FixedCoordLayer
|
$ setLayer FixedCoordLayer
|
||||||
$ uncurryV translate (worldPosToScreen campos p)
|
$ uncurryV translate (worldPosToScreen campos p)
|
||||||
-- $ thickArcFull (rot + a) 1 white (rot + _crDir cr) 1 white (dist mwp p * campos ^. camZoom)
|
$ arcFull (a - rot) 10 white (a' - rot) 1 white (5 + dist mwp p * campos ^. camZoom) white
|
||||||
-- $ arc (rot + a) (rot + _crDir cr) (dist mwp p * campos ^. camZoom)
|
|
||||||
$ color white (circle 100)
|
|
||||||
-- <> arcTest (3*pi/4) 100 green 0 1 red 100
|
|
||||||
<> arcFull 0 5 green (3*pi/4) 50 red 100 white
|
|
||||||
-- <> f green 0 (pi/2) 100
|
|
||||||
-- <> f red 2 3 100
|
|
||||||
<> f blue 4 4.5 100 white
|
|
||||||
-- <> f 0 2 120 <> f 0 3 140 <> f 0 4 160 <> f 1 0 180 <> f 2 0 200
|
|
||||||
-- <> f 3 0 220 <> f 4 0 240
|
|
||||||
-- <> f (-0.5) 0.5 260 <> f 0.5 (-0.5) 280
|
|
||||||
where
|
where
|
||||||
f col a b c = arcFull a 25 col b 1 red c
|
cdir = _crDir cr
|
||||||
--f a b c = thickArc a b c 5
|
rot = campos ^. camRot
|
||||||
--rot = campos ^. camRot
|
|
||||||
p = _crPos cr
|
p = _crPos cr
|
||||||
campos = w ^. cWorld . camPos
|
campos = w ^. cWorld . camPos
|
||||||
--theinput = w ^. input
|
theinput = w ^. input
|
||||||
--mwp = mouseWorldPos theinput campos
|
mwp = mouseWorldPos theinput campos
|
||||||
|
|
||||||
anyTargeting :: Configuration -> World -> SPic
|
anyTargeting :: Configuration -> World -> SPic
|
||||||
anyTargeting cfig w = fromMaybe mempty $ do
|
anyTargeting cfig w = fromMaybe mempty $ do
|
||||||
|
|||||||
Reference in New Issue
Block a user