Add source files, commit before reverting pictures to lists
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
module Dodge.Debug where
|
||||
|
||||
import Dodge.Data
|
||||
import Dodge.Base
|
||||
|
||||
import Geometry.Data
|
||||
import Picture
|
||||
|
||||
import Control.Lens
|
||||
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
|
||||
drawCircleAtFor :: Point2 -> Int -> World -> World
|
||||
drawCircleAtFor p t w =
|
||||
let n = newParticleKey w
|
||||
in over particles ( IM.insert n
|
||||
Particle { _ptPos = p
|
||||
, _ptStartPos = p
|
||||
, _ptVel = (0,0)
|
||||
, _ptPict = onLayer PtLayer $ uncurry translate p $ color white $ circleSolid 20
|
||||
, _ptID = n
|
||||
, _ptUpdate = ptTimer t n
|
||||
} ) w
|
||||
drawCircleAtForCol :: Point2 -> Int -> Color -> World -> World
|
||||
drawCircleAtForCol p t col w =
|
||||
let n = newParticleKey w
|
||||
in over particles ( IM.insert n
|
||||
Particle { _ptPos = p
|
||||
, _ptStartPos = p
|
||||
, _ptVel = (0,0)
|
||||
, _ptPict = onLayer PtLayer $ uncurry translate p $ color col $ circleSolid 20
|
||||
, _ptID = n
|
||||
, _ptUpdate = ptTimer t n
|
||||
} ) w
|
||||
drawLineForCol :: [Point2] -> Int -> Color -> World -> World
|
||||
drawLineForCol ps t col w =
|
||||
let n = newParticleKey w
|
||||
in over particles ( IM.insert n
|
||||
Particle { _ptPos = head ps
|
||||
, _ptStartPos = head ps
|
||||
, _ptVel = (0,0)
|
||||
, _ptPict = onLayer PtLayer $ color col $ lineOfThickness 5 ps
|
||||
, _ptID = n
|
||||
, _ptUpdate = ptTimer t n
|
||||
} ) w
|
||||
|
||||
ptTimer :: Int -> Int -> World -> World
|
||||
ptTimer 0 i = over particles (IM.delete i)
|
||||
ptTimer time i = set (particles . ix i . ptUpdate) $ ptTimer (time - 1) i
|
||||
Reference in New Issue
Block a user