SDL Game Development
上QQ阅读APP看书,第一时间看更新

Chapter 1. Getting Started with SDL

Simple DirectMedia Layer (SDL) is a cross-platform multimedia library created by Sam Oscar Latinga. It provides low-level access to input (via mouse, keyboard, and gamepads/joysticks), 3D hardware, and the 2D video frame buffer. SDL is written in the C programming language, yet has native support for C++. The library also has bindings for several other languages such as Pascal, Objective-C, Python, Ruby, and Java; a full list of supported languages is available at http://www.libsdl.org/languages.php.

SDL has been used in many commercial games including World of Goo, Neverwinter Nights, and Second Life. It is also used in emulators such as ZSNES, Mupen64, and VisualBoyAdvance. Some popular games ported to Linux platforms such as Quake 4, Soldier of Fortune, and Civilization: Call to Power utilize SDL in some form.

SDL is not just used for games. It is useful for all manner of applications. If your software needs access to graphics and input, chances are that SDL will be a great help. The SDL official website has a list of applications that have been created using the library (http://www.libsdl.org/applications.php).

In this chapter we will cover the following:

  • Getting the latest SDL build from the Mercurial repository
  • Building and setting up SDL in Visual C++ 2010 Express
  • Creating a window with SDL
  • Implementing a basic game class