adjusted example
This commit is contained in:
parent
9d50f8a7e0
commit
5a44486477
1 changed files with 5 additions and 6 deletions
|
@ -101,27 +101,26 @@ update sec = do
|
|||
nps <- updateParticleSystem (partsys ud) sec partUpd partDraw
|
||||
putAffection $ ud { partsys = nps }
|
||||
traceM $ (show $ 1 / sec) ++ " FPS"
|
||||
ev <- liftIO $ SDL.pollEvent
|
||||
maybe (return ()) (\e ->
|
||||
ev <- liftIO $ SDL.pollEvents
|
||||
mapM_ (\e ->
|
||||
case SDL.eventPayload e of
|
||||
SDL.MouseButtonEvent dat -> if sec < 0.03
|
||||
then do
|
||||
SDL.MouseButtonEvent dat -> do
|
||||
let (SDL.P (SDL.V2 x y)) = SDL.mouseButtonEventPos dat
|
||||
vx <- liftIO $ randomRIO (-20, 20)
|
||||
vy <- liftIO $ randomRIO (-20, 20)
|
||||
life <- liftIO $ randomRIO (1, 5)
|
||||
traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
|
||||
putAffection $ ud
|
||||
{ coordinates = Just (fromIntegral x, fromIntegral y)
|
||||
, partsys = (partsys ud)
|
||||
{ psParts = (Particle
|
||||
{ particleLife = 5
|
||||
{ particleLife = life
|
||||
, particlePosition = (fromIntegral x, fromIntegral y)
|
||||
, particleRotation = 0
|
||||
, particleVelocity = (vx, vy)
|
||||
}) : (psParts $ partsys ud)
|
||||
}
|
||||
}
|
||||
else return ()
|
||||
SDL.WindowClosedEvent _ -> do
|
||||
traceM "seeya!"
|
||||
put $ ad
|
||||
|
|
Loading…
Reference in a new issue