Haskell Graphics Programming in Linux/Unix - haskell

I am interested in making a game in Haskell and I am looking for a graphics library. I found one called the HUGS Graphics Library but much to my dismay it only runs on Win32. I was wondering if there was a graphics library for Linux/Unix Haskell programming or am I out of luck. Thank you for reading.

Do you know about hackage? Hosted on hackage are lots of graphics-related libraries. Low level OpenGL bindings (openglraw, glut, hgl, glfw), higher level special-purpose GL libraries (ex: gloss), 2D libraries (cairo, gtk, gd), and more. For 2D I suggest you see this related question.

Raincat is a simple puzzle game written in Haskell that demonstrates graphics library usage and some strait forward techniques. Try looking up some Haskell SDL and OpenGL tutorials to help you in understanding the code. I am looking forward to playing your game.
Regards,
http://hackage.haskell.org/package/Raincat

Related

Use multiple graphical windows in OCaml

OCaml comes with the Graphics module which allows the use of a graphical window.
Is it possible to open two graphical window, and switch between them ?
The Graphics module provides machine-independent tools but in case of a negative answer, perhaps it would also be interesting to have solutions for different window system, such as X11.
I looked through the Graphics module API and I don't see support for multiple windows. I would assume Graphics was intended as something useful but simple enough to be part of the base OCaml release.
For more complex graphics, it makes sense just to provide OCaml bindings to an existing library. If I go to opam.ocaml.org/packages and search for "graphics" I see a few possibilities.
I have done OpenGL coding in OCaml but in fact I had to build some wrappers for OS-native GUI functionality to create the windows. This was many years ago, however.
The Graphics module is quite limited and is more intended as a simple basic library for teaching purposes. A possible replacement for Graphics might be the tsdl package which is a thin wrapper around the SDL C library which should work on most platforms.

Haskell GUI programming tools

This might seems silly question but for me it is annoying.
I have installed Haskell platform in my PC using Portable option from the installation options as I do not have admin privileges. So the total Haskell files are now stored in D Drive and I am able to use this without any problems. But when I search for GUI programming in Haskell I have got many articles in Google and I came to final conclusion that I need another library or tool or plugin(I dont know which is correct) to make GUI programming possible in Haskell.
But here my questions are:
What are best tools for windows for GUI programming?
How to install the extra library or tool and attach it to
portable Haskell platform?
The Haskell wiki has a comprehensive list of available GUI libraries for Haskell.
The problem with GUI programming in Haskell is not so much the lack of available tools and libraries, but the fact that using Haskell to write GUI programs in the usual imperative event driven style doesn't take full advantage of the functional nature of Haskell.
There are a number of approaches aiming to address this problem, but, as far as I know, they are all pretty much at the "research" stage, meaning they are not yet quite as mature (both in theory and in practice) as the mainstream (non-functional) techniques. If you are interested in this direction, take a look at some of the functional reactive projects listed in that wiki page, as well as reactive-banana.
As for your second question (how to install Haskell libraries), you can use cabal, which is included in the Haskell Platform. This page explains how to install packages with it.

Interfacing LIRC with Haskell

I've been using pyLirc while prototyping a small application in Python. For performance reasons (among others) I'm moving to Haskell, but can't find any modules providing similar functionality. Should I just stick with "lirc_client.h" or are there any alternatives?
There's no Haskell binding to Lirc yet. It doesn't look too hard.

Prerequisite for learning directx

I am from .net C# background and I want to learn DirectX. I have knowledge of C++ but I am fairly new to graphic world.
I am little confused about how to start learning directx, should I start learning direct directly or buy a basic graphic book like hern and baker and then jump to directx.
Which is the recommended book for learning basic graphic concepts, is it hern and baker? Is there any directx book which will cover graphic concepts as well?
I think that keeping a basic graphics book is allways good, because i can use it as reference anytime
Any suggestions from experts here?
You say that you have a C# background so I am going to assume you are more comfortable with C# then C++. Also, you say that you have knowledge of C++ so I will assume that you already have an understanding of memory management.
If you just want to learn and become more comfortable with the graphics pipeline you should check out SlimDX and XNA. They both allow you to use DirectX without having to dive into C/C++.
As for whether to learn the theory or API first I don't think you should do either one first. It makes sense to learn them asynchronously. Pick up a book on the theory but mess around with an API at the same time.
I highly recommend XNA. People commonly say that you should stick with C++ if you want to develop games but I strongly disagree. XNA will allow you to learn more high level game concepts in less time than if you use C++ and DirectX alone. You will be able to focus on learning why you are doing something rather than how to manage the memory. If in the future you decide that game development is a serious passion then by all means C++ is the way to go. You will find that XNA's graphics pipeline closely mirrors DirectX 9 and wont have much trouble moving to C++.
Also, DirectX 9 should be good enough for any beginner and it will give you a better understanding of how and why things have changed in 10 and 11. However, if you really want bleeding edge technologies you can try out SlimDX which is a C# wrapper for DirectX.
With all this said, XNA offers many easy to understand samples that you can start playing with on their educational catalog page. Also, check out ziggyware (great collection of xna tutorials).
Also, there are many blogs you can check out. A lot of them have excellent tutorials on them. Here are some off the top of my head:
Reimer Grootjans
Shawn Hargreaves
Richard Dodsworth
Renaud Bédard
Nick Gravelyn
Finally, here are 2 graphics books that I highly recommend (they are pretty complex and will last you a long time):
Fundamentals of Computer
Graphics
Real-Time Rendering
They are not directly related to DirectX, but rather they cover the theory every graphics developer should know. (from linear algebra to texture mapping to volumetrix rendering...)
Well I have to disagree with the C# option. If you don't have a deadline to finish the game, then I recommend using the language that teach you most. Working with 3d graphics is A LOT about management so if you are avoding it you are not actually learning but just using it, ie. you not only have to manage memory but the actual render calls you make and the device state changes, a lot of things that you will never know by avoding lower level, and which applies for other APIs too such as OpenGL or for other kind of devices. I think the best way of knowing how the api works is by using the api, instead of a bunch of helper libraries. You can use the helper libraries when you really need it instead (which you can find in their C++ version anyway).
In the DX SDK you can also find the Sample Browser with some sample applications with their documentation and you have the DirectX Utility Toolkit which contains a framework and libraries to make a DirectX app without having to worry much about the nasty device things such as enumeration and config. It also comes with a GUI system and a settings dialog for the device config. I doubt you can find those in C# and they are very good if you want to start with DX.
Some resources that helped me when I started were
the zophusX tutorials
and a book called "Introduction to 3D Game Programming with DirectX 9.0c", by Frank D. Luna (there is the DX10 version now)
and probably the book 3d Game Engine Programming by Stephan Zerbst also helped me to understand some things about how to work better with the apis. Though you may have to buy them in order to read them. They are helpful to start with both some theory and using the API at the same time.
I think if your target is to learn how to make a game then you can use any language/library you want you don't even need to know a programming language :) but if your target is learning DirectX and graphics APIs you should definitively start with the C++ api which is the "actual" DX.
If you have a bit of extra money, I was very impressed with the DirectX graphics courses from http://www.gameinstitute.com. The textbook they provide was very good as far as the other DirectX books I've seen are concerned. The first module DirectX Graphics I starts off with a bit of a math review and some 3D fundamentals before diving into setting up and using DirectX. By the end of the first module you will have built a textured terrain renderer and an indoor scene.
Overall the courses are not that expensive when you consider how much books on the subject cost. I would definitely recommend checking it out!

Is there any 2D renderer library with complete fixed point support for embedded linux?

I am working on embedded linux, Is there any open source 2D renderer available which can draw on memory, scanline based, complete fixed-point support.
I work in c or cpp programming language.
I know one with which satisfy my all needs that is, Google Skia which google uses in android and chrome, But I found it without documentation, not straight-forward compilable, not straight-forward usable in 3rd party projects.
Regards, Sunny.
Checkout Cairo. I am not sure what you mean by "complete fixed-point support" but other than that it seems to meet your requirements.
Allegro is a games library which includes extensive software rendering, most of which does not rely on floating point. Additionally it has some trig functions and maths functions which work on fixed-point. It has things like sprite-rotation which don't need floating point.
Don't know if it's what you're looking for, but there's libcrtxy
http://libcrtxy.sourceforge.net/
DirectFB.
If you want hardware acceleration , directFB is the most portable way to go.

Resources