Thursday, February 6, 2014

Book Review #22

Book #22 Programming Linux Games
John R. Hall

Programming Linux Games is an old, old book. In fact, it's obsolete. The reason is that SDL has evolved toward a better set, and some of the functions are deprecated. In addition, it uses plain old C language, that although a great language to use, it has been superceeded by C++, and Java, among other languages. Still, there's enough similarities between this book and current SDL that it's a great introduction to the process of SDL programming.

One of my most frustrating endeavor is finding the proper answer to my question regarding any graphic library: "How do you draw a point on screen?"

That one very simple question is frequently unanswered in great many graphical programming book. I know that's silly, but there you go. This book answers the question right away: Using surface.

"Each SDL_Surface structure contains a pixels member. This is a void * to the raw image, and we can write to it directly if we know the type of pixel that the surface is set up for."

And upon those two sentences, I bought the whole book!

It's a good book, marred only by the fact that it's so old, it's obsolete. However, reading this book followed by reading SDL man pages is infinitely preferable to just going straight on without guidance. The explanations are solid, and adapting the code to newer system is not a problem.

FYI, the ever popular PyGame extension for Python uses SDL for the base. SDL is a good graphic library to learn, especially if you're really interested in harnessing the speed and efficiency of C language.

For those of you still stuck with C programming, give this book a read. You just may like what you see.


  1. Tex Murphy I have often asked that same question. That is why I like petit computer. I can write a pixel to the screen. I have collected some old computer books that I keep at work. PKzip, Vax, Gbasic, etc... I thought placing a pixel on the screen was sending code to a graphics buffer that the monitor pulled from. I don't know much about surfaces but it sounds neat.

  2. I think the problem is that Graphic cards are so sophisticated that they're like mini computers. You can't just access the data fields directly. You have to do some kind of handshaking communication protocol. Still, there's no reason why a graphic library can't add simple interface to the process, even if it comes out slower.