Implement arc rendering, works for increasing angle difference < 2pi

This commit is contained in:
jgk
2021-02-20 08:16:24 +01:00
parent 2866535b52
commit 9ff7810a2d
9 changed files with 101 additions and 104 deletions
+1
View File
@@ -365,6 +365,7 @@ startCr = basicCreature
,hvAutoGun
,teslaGun
,latchkey 0
,frontArmour
]
++ repeat NoItem))
-- startInv
+10 -9
View File
@@ -1811,8 +1811,8 @@ throwArmReset x =
grenadePic :: Int -> Picture
grenadePic x = pictures [ color (dark $ dark green) $ circleSolid 5
, color green $ arc
((179 * fromIntegral x / 50) - 180 )
(180 - (179 * fromIntegral x / 50) )
(degToRad $ (179 * fromIntegral x / 50) - 180 )
(degToRad $ 180 - (179 * fromIntegral x / 50) )
5
, translate (-2) 2 $ rotate (pi*0.5)
$ scale 0.05 0.05 $ color green $ text $ show $ 1 + quot x 20
@@ -2003,7 +2003,7 @@ explodeRemoteBomb itid ptid n w
j = _crInvSel $ _creatures w IM.! n
remoteBombPic :: Int -> Picture
remoteBombPic x = pictures [ color (dark $ dark orange) $ circleSolid 5
, rotate (0 - degToRad (fromIntegral x * 10 + 45)) $ color red $ arc 0 90 5
, rotate (0 - degToRad (fromIntegral x * 10 + 45)) $ color red $ arc 0 (pi/2) 5
, rotate (0 - degToRad (fromIntegral x * 10 + 45)) $ color (withAlpha 0.05 red)
$ arcSolid 0 90 50
, rotate (0 - degToRad (fromIntegral x * 10 + 20)) $ color (withAlpha 0.05 red)
@@ -2372,13 +2372,14 @@ frontArmour = basicEquipment
, _itName = "FRONTARMOUR"
, _itMaxStack = 1
, _itAmount = 1
, _itFloorPict = onLayer FlItLayer $ translate 0 (-5) $ pictures [color (greyN 0.1) $ thickArc 0 90 10 5
,color (greyN 0.1) $ thickArc 270 360 10 5
]
, _itFloorPict = onLayer FlItLayer $ translate 0 (-5)
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
]
, _itEquipPict = (\cr _ -> onLayer CrLayer
$ pictures [color (greyN 0.1) $ thickArc 0 90 (_crRad cr) 5
,color (greyN 0.1) $ thickArc 270 360 (_crRad cr) 5
]
$ pictures [color (greyN 0.1) $ thickArc 0 (pi/2) 10 5
,color (greyN 0.1) $ thickArc (3*pi/2) (2*pi) 10 5
]
)
, _itEffect = NoItEffect
, _itID = Nothing
+1 -1
View File
@@ -484,7 +484,7 @@ crGlareWidth wdth col alphay p cr =
where l x = uncurry translate x
$ rotate (pi*0.5 + argV (p -.- x))
$ color (withAlpha alphay col)
$ thickArc 0 180 (_crRad cr) wdth
$ thickArc 0 (pi/2) (_crRad cr) wdth
cp = _crPos cr
cid = _crID cr
upp cid' w' = case w' ^? creatures . ix cid . crPos of