Add generic derivations and To/FromJSON instances

This commit is contained in:
2022-07-25 22:49:18 +01:00
parent f5604ef429
commit b8e8413daa
99 changed files with 1406 additions and 517 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ import LensHelp
import Data.Maybe
import qualified IntMapHelp as IM
aRadarPulse :: Object -> Creature -> World -> World
aRadarPulse :: ObjectType -> Creature -> World -> World
aRadarPulse ob cr = cWorld . radarSweeps .:~ RadarSweep
{ _rsTimer = 100
, _rsRad = 0
@@ -34,13 +34,13 @@ updateRadarSweep w pt
circPoints = blipsF p r w
r = fromIntegral (400 - x*4)
findBlips :: Object -> Point2 -> Float -> World -> [Point2]
findBlips :: ObjectType -> Point2 -> Float -> World -> [Point2]
findBlips ob = case ob of
ObCreature -> crBlips
ObItem -> itemBlips
ObWall -> wallBlips
_ -> undefined
makeBlip :: Object -> Point2 -> RadarBlip
makeBlip :: ObjectType -> Point2 -> RadarBlip
makeBlip ob = case ob of
ObCreature -> blipAt 8 (withAlpha 0.2 green) 50
ObWall -> blipAt 2 red 50