Hi Peter,
The OpenGL/GLUT bindings support
all the things you would want, but it’s a bit too much pain for first year
students.
For the last couple of years at
the ANU (Australian National University, Canberra) we’ve been using a front end
library that I wrote which is similar to SOE/HGL but with support for images,
animation, alpha blending and some other things. I think the real trick is
hiding enough of the OpenGL/GLUT internals to make it suitable for first year
students, while at the same time exposing enough functionality so they don’t
feel constrained by what they can do with the library. Usually we think of the
project we want the students to do, then supply most of the infrastructure via
the library – leaving the students to fill in the ‘fun’ stuff.
There is the added benefit that
the OpenGL/GLUT bindings (and hence our library also) compiles out of the box on
both Linux and Windows. We use linux machines at uni for the student labs, but
students have been able to take their code home and get it running on their
home Windows PC’s without much difficulty.
You can get our library (with
examples) from my homepage at http://cs.anu.edu.au/people/Ben.Lippmeier/
I’ve also got a simple asteroids
game which I wrote with an extended version of it. There is a playable version,
but unfortunately it’s on my home machine that is now packed in storage while
I’m at MSR, Cambridge. I’m getting back to Canberra late October so if you’re
still interested I can dig it out and send you a copy then.
Cheers,
Ben.
From: haskell-cafe-bounces@haskell.org
[mailto:haskell-cafe-bounces@haskell.org] On Behalf Of peterv
Sent: 24 August 2007 11:32
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] 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