On 17/05/11 01:42, Michael Serra wrote:
eventLoop w cs = do
  drawCells w cs
  e <- waitEventBlocking
  checkEvent e
    where
      checkEvent (KeyUp (Keysym SDLK_ESCAPE _ _)) = return ()
checkEvent (KeyUp (Keysym SDLK_n _ _)) = eventLoop w $ nextgen cs
      checkEvent _                                = eventLoop w cs

Your code is a bit strange. It redraws the window every time there is a window event (whether its an unrelated key-down or a relevant event). So whenever there's some window events, your window rapidly redraws (and in a different set of random colours). I'm not sure this is the intended behaviour? I didn't find any point at which the program didn't advance and redraw when I released 'n' -- but I'm not sure if that was exactly the problem you're having. Can you clarify exactly what the problem is? Is that you're not seeing the keypresses being processed, or is it that you expect more redrawing than there is, etc?

Thanks,

Neil.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to