First implementation of quadratic bezier curve shader

This commit is contained in:
2021-03-12 15:25:07 +01:00
parent 6f1f817ed3
commit 0489a092bc
21 changed files with 372 additions and 37 deletions
+23
View File
@@ -335,6 +335,11 @@ launcher = defaultGun
, _itHammer = NoHammer
, _itEffect = NoItEffect
}
bezierGun = defaultGun
{ _itName = "B-GUN"
, _wpFire = bezierTarget
}
remoteLauncher = defaultGun
{ _itName = "ROCKO-REM"
, _itIdentity = RemoteLauncher
@@ -1402,6 +1407,24 @@ grenadePic x = pictures [ color (dark $ dark green) $ circleSolid 5
$ scale 0.05 0.05 $ color green $ text $ show $ 1 + quot x 20
]
bezierTarget :: Int -> World -> World
bezierTarget cid w = setTarget w
where
j = _crInvSel $ _creatures w IM.! cid
setTarget = set (creatures . ix cid . crInv . ix j . wpFire) $ bezierControl p
p = mouseWorldPos w
bezierControl :: Point2 -> Int -> World -> World
bezierControl targetp cid w = shootWithSound 0 (mkBezierBul startp controlp targetp) cid w
where
controlp = mouseWorldPos w
cr = _creatures w IM.! cid
dir = _crDir cr
startp = _crPos cr +.+ rotateV dir (_crRad cr + 1,0)
mkBezierBul :: Point2 -> Point2 -> Point2 -> Int -> World -> World
mkBezierBul startp controlp targetp cid w = w
fireRemoteLauncher :: Int -> World -> World
fireRemoteLauncher cid w = setLocation $ resetFire $ resetName
$ soundOnce (fromIntegral launcherSound)
+6 -2
View File
@@ -75,6 +75,7 @@ worldPictures w
-- , itLabels
, ppLabels
, btLabels
, testPic w
]
where
decPicts = IM.elems $ _decorations w
@@ -119,6 +120,11 @@ worldPictures w
]
where tst x y sc t = translate x y $ scale sc sc $ color white $ text t
testPic :: World -> [Picture]
testPic w = [setLayer 1 $ onLayerL [99] $ color red $ bezierQuad (-90,0) (90,-50) (-200,200) ]
-- $ uncurry translate (mouseWorldPos w)
hudDrawings :: World -> Picture
hudDrawings w = setLayer 1 $ (onLayer InvLayer)
$ pictures
@@ -463,8 +469,6 @@ displayHP n w = translate (halfWidth w-80) (halfHeight w-20) $
scale 0.2 0.2 $ text $ reverse $ take 5 $ (++ repeat ' ') $ reverse $ show
$ _crHP $ _creatures w IM.! n
testPic w = blank
wallsForGloom :: World -> [(Point2,Point2,Point2,Point2)]
wallsForGloom w = map (linePairs . _wlLine) $ filter (not . _wlIsSeeThrough)
$ filter wallCastsShadow