[Haskell-cafe] wxFruit with OpenGL and IO action

shelarcy shelarcy at gmail.com
Thu Aug 17 05:36:31 EDT 2006


Sometimes, a few people are interested in wxFruit.


But nobady knows current status of wxFruit. Over one
and half year ago, I heard that students working on
that ... .


So, I'm working on that for subproject of Kamiariduki
... but progress is very slowly.

I uploaded current (initial) version on Kamiariduki's
file space. File name is "YaPan-initial.tgz".

Because this file includes YaPan - Yet another
implementation, and reimplementation of Panic
using Yampa (and wxFruit).


I didn't think current verion is good enough to
announse [Haskell] list, so I didn't announce that and
repraced "YaPan.tgz" file sometimes ... but I know that
a few people downloaded my file already. So, I decide
to upload initial file on that space.

Of cource, "YaPan-initial.tgz" has other wxFuit example.
paddle.hs is almost same as original example, except
that use menu istead of button. And CFK_GL* is a OpenGL
sample code.

But current version has some faults. Cabal file support
to build and install only YaPan, doesn't support wxFruit.
Code is very messy, and YaPan doesn't support all of
Panic's features.

And I should notice additonal things for older version's
user. Now YaPan depends on AutoForms (not for wxFruit


And YaPan can't save static one picture, YaPan can save
animation by consecutive number files only.

Current version, I tested on only Windows with my build
of wxWidgets 2.4.2's wxHaskell (I uplaoded Kamiariduki's
file space) and afrp-0.4 environment. So I don't know
wxFruit and YaPan can works well other environments.

Finally, I show current problem of wxFruit with IO

I extend that button menu allow to regist extra IO
action like this.

pan pixels = hBox $ proc _ -> do
   let start = False
   rec v <- boxSF $ iPre 0 -< 1 + v
       ev <- getEvent -< ()
       vTrans <- boxSF $ iPre (0,0,1) -< (keyboardEvent 0.1 vTrans) ev
       panedPixels <- boxSF $ pictureEvent -< (pixels, vTrans, (circle v),  
v, gameBox)
       _ <- glpicture (glpsizeWithAttributes gameBox [WXCore.GL_RGBA,  
WXCore.GL_DOUBLEBUFFER]) -< glppic $ paintGL gameBox panedPixels
       _ <- menu (mtextWithDialog "&SaveImage")
            -< mcommandWithDialog $
                 (\v f -> saveImageHandler (animToDisplayFun (circle))  
circle (WX.sizeW gameBox, WX.sizeH gameBox) vTrans 1 v f) v
   returnA -< ()

This design is suitable for button and menu's command.
But if I want to use IO action out of these control
event, modualiry is broken. Because I want to do that
action out of control's event, but I have to change
control's action. And I must choose using what kind of
event handler. (Is interval the best?)

So I tried to implement command function that intend to
use IO action on reative loop wihtout control  in
wxFruit.hs ... but action doesn't do registered action
or program is not work on my apporoach. (I commented out
current command function that occur action.)

If anyone have good idea how to use IO action on wxFuit,
please tell me that idea.


shelarcy <shelarcy    capella.freemail.ne.jp>

More information about the Haskell-Cafe mailing list