I’m experimenting with using Haskell for a 2D game project in one of my computer science classes.  It will probably involve the Chipmunk 2D physics engine (haskell has a binding to it called Hipmunk).  Hipmunk comes with a demo app called the Hipmunk Playground, and it is a wonderful little demo of OpenGL and Chipmunk in Haskell.

Unfortunately, Mac OS X has some austere requirements for graphical applications.  When I first ran Hipmunk Playground, the window would not respond properly to my keyboard and mouse inputs.  The solution, it seems, is to wrap the Haskell-generated executable inside a well-formed “.app” directory.  The (unrelated) wxHaskell library provides a nice shell script called macosx-app to generate the .app directory automatically.  Here is a sample Makefile that I now use to build Hipmunk Playground and put it inside the wrapper directory:
# Make the Hipmunk Playground application for Mac OS X
MacPlayground: Playground
utils/macosx-app Playground
Playground: Playground.hs
ghc –make Playground.hs
RunPlayground: MacPlayground
open Playground.app

Posted via email from Duane’s Quick Posts