[Haskell-cafe] reactive-banana GLFW-b event register example

Jason Dagit dagitj at gmail.com
Thu May 8 17:52:49 UTC 2014


On Thu, May 8, 2014 at 5:08 AM, Vlad Lopatin <madjestic13 at gmail.com> wrote:

> Hello List,
>
> I am trying to make the following quasi-code example work:
>
> registerMouseButton :: IO (Event MouseButton)
> registerMouseButton = do(addHandler, fire) <- newAddHandler
> setMouseButtonCallback $ \button _ -> fire button
> fromAddHandler addHandler
>
>
> According to
> http://stackoverflow.com/questions/8631816/reactive-banana-how-to-create-an-addhandlerit looks like it should be something straightforward.
>
> Can somebody show an example of a functional code that registers a key or
> a mouse event?
>

I don't have mouse registration, but this code should work for keys:
https://github.com/dagit/1GAM/blob/master/pong/reactive-banana/Main.hs#L114

I haven't tested it in a while, but according to the git log I tested it
against reactive-banana and GLFW-b at some point :)

Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140508/e2bd1ffa/attachment.html>


More information about the Haskell-Cafe mailing list