In the previous post we cobbled together an SDL2 project in Xcode 9. We have a very simple program that starts up, initialises the SDL2 framework and then shuts down. This gets us over the initial hurdle of setting up a game project but we are still along way off from having a working game. In this second part, I will be writing a simple game loop using SDL2. If you don’t know what a game loop is, or need a refresher, go ahead and read about it in Game Programming Patterns. The game loop is an important foundation of any game engine and its important to get right. I plan to develop this over two articles, in the first (This one) we’ll get the basic loop in place. Then in part 2, we’ll refactor the basic loop into something more maintainable. Anyway, without further ado, let’s get started.

Continue reading