26 lines
584 B
Haskell
26 lines
584 B
Haskell
module Dodge.RadarBlip where
|
|
|
|
import Dodge.Data.RadarBlip
|
|
import Geometry.Data
|
|
import LensHelp
|
|
import Picture
|
|
|
|
updateRadarBlip :: RadarBlip -> Maybe RadarBlip
|
|
updateRadarBlip rb
|
|
| _rbTime rb <= 0 = Nothing
|
|
| otherwise = Just $ rb & rbTime -~ 1
|
|
|
|
drawBlip :: RadarBlip -> Picture
|
|
drawBlip pt =
|
|
setDepth (-0.5)
|
|
. setLayer DebugLayer
|
|
. uncurryV translate p
|
|
. color (withAlpha (fromIntegral t / fromIntegral maxt) col)
|
|
$ circleSolid r
|
|
where
|
|
p = _rbPos pt
|
|
t = _rbTime pt
|
|
r = _rbRad pt
|
|
col = _rbColor pt
|
|
maxt = _rbMaxTime pt
|