Beyond the C++ Standard Library
The C++ Standard Library only supports text console input and output and does not have any graphics libraries built in. To implement graphics in a C++ program, you must use one of the many available external libraries.
Unfortunately, many libraries are platform specific, meaning they work on only one operating system or type of computer. For example, the Microsoft Windows application programming interface (API) can create windows and other UI elements supported by the Windows operating system. However, the Windows API doesn’t work on Apple macOS—for obvious reasons. Likewise, macOS has its own set of libraries for these same features that do not work on Windows. As a game programmer, you can’t always avoid platform-specific libraries. For instance, game developers working with the Sony PlayStation 4 console must use libraries provided by Sony.
Luckily, this book sticks to cross-platform libraries, meaning that the libraries work on many different platforms. All the source code for this book works on recent versions of both Windows and macOS. Although Linux support is untested, the game projects generally should also work on Linux.
One of the foundational libraries used in this book is Simple DirectMedia Layer (SDL; see https://www.libsdl.org). The SDL library is a cross-platform game development library written in C. It provides support for creating windows, creating basic 2D graphics, processing input, and outputting audio, among other features. SDL is a very lightweight library that works on many platforms, including Microsoft Windows, Apple macOS, Linux, iOS, and Android.
In this first chapter, the only external library needed is SDL. Subsequent chapters use other libraries and introduce them when needed.