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.
I’ve put together a couple of side projects with SDL2 over the years. I like the library because of it’s simplicity and how it provides a quick way to throw together a cross platform project. This post is a reasonably comprehensive guide to how I set up an Xcode 9 project that links to the latest SDL2 framework. There are other ways to do it, but this is mine.
I’ve done a fair bit of development in Visual Studio and Eclipse over the years. One of the feature of those IDEs have that XCode strangely lacks is the ability to automatically generate a decent doc comment for a method.
After a bit of googling today I cam across the VVDocumenter plugin for XCode that does exactly what I want. Well worth a look if you want to get into the habit of documenting your code properly. The article linked below provides everything you need to get started with it.
How to Generate Beautiful Apple-Style Documentation in Xcode 5 | Objective C#.