Book Image

SDL Game Development

By : Shaun Mitchell
5 (1)
Book Image

SDL Game Development

5 (1)
By: Shaun Mitchell

Overview of this book

SDL 2.0 is the latest release of the popular Simple DirectMedia Layer API, which is designed to make life easier for C++ developers, allowing you simple low-level access to various multiplatform audio, graphics, and input devices.SDL Game Development guides you through creating your first 2D game using SDL and C++. It takes a clear and practical approach to SDL game development, ensuring that the focus remains on creating awesome games.Starting with the installation and setup of SDL, you will quickly become familiar with useful SDL features, covering sprites, state management, and OOP, leading to a reusable framework that is extendable for your own games. SDL Game Development culminates in the development of two exciting action games that utilize the created framework along with tips to improve the framework.
Table of Contents (16 chapters)
SDL Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing SDL_image


So far we have only been loading BMP image files. This is all that SDL supports without any extensions. We can use SDL_image to enable us to load many different image file types such as BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, and XV. First we will need to clone the latest build of SDL_image to ensure it will work with SDL 2.0:

  1. Open up the TortoiseHg workbench and use Ctrl + Shift + N to clone a new repository.

  2. The repository for SDL_image is listed on http://www.libsdl.org/projects/SDL_image/ and http://hg.libsdl.org/SDL_image/. So let's go ahead and type that into the Source box.

  3. Our destination will be a new directory, C:\SDL2_image. After typing this into the Destination box, hit clone and wait for it to complete.

  4. Once you have created this folder, navigate to our C:\SDL2_image cloned repository. Open up the VisualC folder and then open the SDL_image_VS2010 VC++ project with Visual Studio 2010 express.

  5. Right-click on the SDL2_image project and then...