2D game graphics library for Haskell?

I’m currently playing around with SOE to make some simple interactive math exercises for students. This worked fine, although I could have done this much faster using C# (which I know very well), but since I’m addicted to Haskell now, I used the latter language ;) Furthermore, I hope that one day, I will know enough Haskell to learn it to the students, because I feel that functional programming should not be given in the last bachelor or master years, since most software engineering students then know OO programming extremely well and have a horrible time with FP (I currently did not meet anyone in my sector of game development that liked FP, and many of those people had a masters degree and some were PhDs) Anyway, SOE is great for learning Haskell, but it lacks a couple of fundamental functions to make it really attractive, like: - Support for images - Support for rendering to an “offscreen graphics surface” and reading the pixels from that surface (for pixel-wise collision detection) - Support for detecting non-ASCII key presses (cursor keys, etc) - Support for joysticks Concurrent Clean seems to have a nice 2D game library and PLT/DrScheme also has nice support for basic 2D graphics, but somehow I feel Haskell is more mature and more elegant. So before digging into “advanced” APIs (like GTK itself, which I know nothing about, I’m a Win32 GDI/XNA/WPF expert), I should ask the question if something similar exists? It has to be as simple as SOE. Would it be possible to extend the GTK SOE with support for the features mentioned above? Is this insanely difficult for someone like me who knows a lot about Win32 but little Haskell? Thanks, Peter Verswyvelen No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.4/969 - Release Date: 23/08/2007 16:04

On Fri, 2007-08-24 at 12:31 +0200, peterv wrote:
Anyway, SOE is great for learning Haskell, but it lacks a couple of fundamental functions to make it really attractive, like:
- Support for images
- Support for rendering to an “offscreen graphics surface” and reading the pixels from that surface (for pixel-wise collision detection)
- Support for detecting non-ASCII key presses (cursor keys, etc)
- Support for joysticks
Concurrent Clean seems to have a nice 2D game library and PLT/DrScheme also has nice support for basic 2D graphics, but somehow I feel Haskell is more mature and more elegant.
So before digging into “advanced” APIs (like GTK itself, which I know nothing about, I’m a Win32 GDI/XNA/WPF expert), I should ask the question if something similar exists? It has to be as simple as SOE.
Would it be possible to extend the GTK SOE with support for the features mentioned above? Is this insanely difficult for someone like me who knows a lot about Win32 but little Haskell? Graphics.SOE.Gtk is actually based on a very nice vector graphics library Graphics.Rendering.Cairo which can certainly do nice things like rendering to off-screen surfaces and much more besides, like transparency, arbitrary affine scaling/rotation/translation. It can load and save images in png and svg formats. It's also got a rather nice API, so instead of trying to extend the GTK SOE you might find it simpler just to use Cairo directly. Gtk+'s event processing can certainly detect non-ASCII key presses, it's just the SOE getKey api that's limited to Char. I've no idea how joystick input is implemented in X/Gtk, I expect it's possible. The other alternative though it's getting more low level, is to use the Haskell bindings for SDL. Duncan
participants (2)
-
Duncan Coutts
-
peterv