I decided to buy a domain for DevHub, as I am getting no Pagerank because of the subdomain I am using. You can still get to this site through devhub.lostfish.org, but the direct URL is now http://www.sdltutorials.com. I hope this will bring in a lot more traffic and help people find more relevant information about developing games. I don’t want people to think I am specializing in SDL only, but rather everything we do here will be built upon SDL. So expect in the future OpenGL, Lua, and other libraries being used upon SDL.
Last week I decided to move over my server to Media Temple on their Grid Server. Hopefully this is a good move, since I saw both positive and negative comments about this. I have a bunch of other websites that I host, alongside a friend, so hopefully it works out for the best. This is what caused the downtime the other day, in case anyone is wondering.
On another note, I am working on the next SDL tutorial for Entities. It’ll be a little bit more complex than what we have so far. Also, I figured out a way to turn that stupid RTE editor off in Wordpress, so hopefully we don’t have any half-posts, or & showing up in posts anymore. I tried to do a little bit of SEO on my posts, so you may notice function names and titles being bolded or linked back to the post. And hopefully I was able to find all the mess ups in the code thus far.
I want to say thank you to everyone for your posts so far, every comment is encouraging to me and helps me want to post more tutorials. With that said, I encourage everyone to post their comments.
The last tutorial we took our chance at making a Tic-Tac-Toe game. Hopefully most of you were successful in getting it to work. If not, don’t fret, you’ll get the hang of all of this eventually.
In this tutorial we are going to take our hand at SDL Animation. As before, we’ll be building on top of the previous SDL lessons (but not including the Tic Tac Toe one). So lets get started.
We’ll be creating a new class to handle Animation, and in the next tutorial we will create a class to handle Entities. Please keep in mind that these two things are seperate, and while I know they could be one class, I don’t wish to take that approach. So please hold back your criticism.
Up to this point we have been laying the foundation for developing a game. So far we’ve setup a basic structure to handle common routines, we’ve setup a special class to handle events, and we’ve also setup a class to handle a few surface functions. In this tutorial we’ll take all those things, combine them, and create a tic-tac-toe game. Don’t worry, things should be pretty simple. Use the last tutorial to build off of.
The first thing we are going to need to do is plan our game. From experience, we know that tic-tac-toe has a 3×3 grid, where you place X’s and O’s. So, we know that we will need 3 graphics, one for the grid, one for the X, and one for the O. We don’t need multiples of the X or O, because we can draw them in the program as many times as we like. Lets eliminate this first step. Our grid is going to be 600×600, and our X’s and O’s will be 200×200 (1/3 of the area).
Alongside the basics of game development is something called Events. Events are basically interactions the program has with the user. These events can be keyboards, mice, joysticks, gamepads, and so on, or events from our operating system. It’s important to understand how events work if we are to approriately interact a user with a game. We’ve already been using events, but only for closing our window, now we’ll look at how to receive events from the user. Read the rest of this entry »
Using the first tutorial as our base, we’ll delve more into the world of SDL surfaces. As I attempted to explain in the last lesson, SDL Surfaces are basically images stored in memory. Imagine we have a blank 320×240 pixel surface. Illustrating the SDL coordinate system, we have something like this:

This coordinate system is quite different than the normal one you are familiar with. Notice how the Y coordinate increases going down, and the X coordinate increases going right. Understanding the SDL coordinate system is important in order to properly draw images on the screen. Read the rest of this entry »
These tutorials are meant to teach someone with some experience using C++, or perhaps another programming language. If you have a hard time following certain ideas related to the code itself and not conceptual ideas (those relating to games), then I urge you to first read our tutorials that explain the C++ programming language. It’s not vital to understand everything about C++, but every little bit will help later on.
In these tutorials we will be referncing to CodeBlocks as our IDE of choice, with gcc and mingw for compilation. If you wish to use another IDE and compiler that is up to you, but it may be harder to follow along if you have limited experience with linking libraries. If you wish to download CodeBlocks, you can do so for free at http://www.codeblocks.org (download the one including the mingw package). We recommend you use the stable version, unless you want to spend the extra time and use the nightly builds.
