OpenGL in Haskell

I’m working on a maze game to learn Haskell. It’s name: DuDuHoX. The reason is explained in my portuguese blog.

The first game interface is for console. It uses the package System.Console.ANSI. Works pretty well in Linux and Mac OS, except for Windows which has a small buffer problem, forcing the player to hit enter after every move.

DuDuHoX versão console

I decided to create a new interface for the game this week. With graphics and with no buffer problem for Windows.

At first, I tried to use SDL, because I’ve used it to create a maze game in C. Had no success, couldn’t even compile an example.

Thought about using OpenGL directly for graphics, but didn’t know what to use to manage user input. I’ve seen some complaints about OpenGL and GLUT in this regard. After some searches, I found GLFW, a C open-source library that do everything I need, and the most important: there is a GLFW Haskell package that does the binding.

After some hours learning OpenGL and GLFW in Haskell, this is the result:

DuDuHoX versão gráfica

You can play with this new interface, but the console one has more features. So, for the next weeks, I’ll try to add these features and some nice textures to the OpenGL interface. The TODO list and the code is available at GitHub:

Happy 2013!