Permalink
Browse files

Fix Pong.hs to use contains instead of ix

  • Loading branch information...
1 parent 57421c6 commit 8b5477dbcb3acdab5f22c2c0a8926710fce2446b @glguy glguy committed Feb 26, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 examples/Pong.hs
View
@@ -111,7 +111,7 @@ updatePaddles time = do
p <- get
let paddleMovement = time * paddleSpeed
- keyPressed key = p^.keys.ix (SpecialKey key)
+ keyPressed key = p^.keys.contains (SpecialKey key)
-- Update the player's paddle based on keys
when (keyPressed KeyUp) $ paddle1 += paddleMovement
@@ -205,7 +205,7 @@ drawScore (x, y) = scale textSize textSize . text $ show x ++ " " ++ show y
-- Handle input by simply updating the keys set
handle :: Event -> Pong -> Pong
-handle (EventKey k s _ _) = keys.ix k .~ (s == Down)
+handle (EventKey k s _ _) = keys.contains k .~ (s == Down)
handle _ = id
-- The main program action

0 comments on commit 8b5477d

Please sign in to comment.