reactive-banana GLFW-b event register example

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

reactive-banana GLFW-b event register example

Vlad Lopatin
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-addhandler it looks like it should be something straightforward.  

Can somebody show an example of a functional code that registers a key or a mouse event?


Thanks,
Vladimir

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: reactive-banana GLFW-b event register example

Jason Dagit-3



On Thu, May 8, 2014 at 5:08 AM, Vlad Lopatin <[hidden email]> 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-addhandler it 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

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: reactive-banana GLFW-b event register example

Vlad Lopatin
Thanks, Jason!  The example compiled.  I thing that's exactly what I need to break through this.  I am going to study your code for some time now.


On 8 May 2014 19:52, Jason Dagit <[hidden email]> wrote:



On Thu, May 8, 2014 at 5:08 AM, Vlad Lopatin <[hidden email]> 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-addhandler it 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


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: reactive-banana GLFW-b event register example

Jason Dagit-3



On Thu, May 8, 2014 at 2:48 PM, Vlad Lopatin <[hidden email]> wrote:
Thanks, Jason!  The example compiled.  I thing that's exactly what I need to break through this.  I am going to study your code for some time now.

Sure. That was a toy I wrote to learn basic FRP. I should warn you, because of the integration it has a massive space leak and quickly becomes unresponsive. Browse around in that repo for other version of pong that are playable. If I recall correctly, the yampa version works pretty well.



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe