Beginner's Guide to SDL

Building Games with SDL and C++

I wrote this with the students of Ocean County College in mind. I wanted to create something that complemented the material they were learning in their second C++ course. The C++ course series at the college is partitioned into three courses:
  • Course 1 - covers simple data types, user-defined data types, string, operators, input, output, control structures, the ifStatement, switchStatement, loops using forStatement, whileStatements, and functions.
  • Course 2 - covers arrays, strings, vectors, structs, classes, pointers, overloading and virtual functions
  • Course 3 - covers over templates, exception handling, recursion, linked lists, stacks, and queues

The book used in the course is a good one - "C++ Programming: From Analysis to Program Design" by D.S. Malik. The only problem I saw with the book is that many students were looking for problems to solve that they could relate to - games. I originally wrote a set of notes on Windows Console Programming that demonstrated how to build Pong, Breakout and Mindsweeper with just the Windows Console. I did not realize until recently that a better way to stimulate thinking and usage of the C++ constructs we were learning in the second course was to use a tool as simple and as powerful as SDL. SDL provides the capability for students to learn the key concepts of classes, pointers, and arrays and actually enjoy the programs they build since most can relate to the elements of a game. I don't see these notes as a replacement of the material in the book. In fact, a good C++ student should read the material, look over the exercises and do as many programs as they can fit into their schedule.

The second goal is to explain in some detail the new C++ constructs starting in Course #2. So if you are more experienced and you don't need an explanation of classes or pointers or other features I may think someone just learning C++ may not know then feel free to skip over those sections.

Have fun and build a fun game!

Places to Visit and Files