SDL Game Development

If you’re good with C++ and object oriented programming, this book utilizes your skills to create 2D games using the Simple DirectMedia Layer API. Practical tutorials include the development of two wickedly good games.

SDL Game Development

Starting
Shaun Mitchell

If you’re good with C++ and object oriented programming, this book utilizes your skills to create 2D games using the Simple DirectMedia Layer API. Practical tutorials include the development of two wickedly good games.
$10.00
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

+ Collection
Free Sample

Book Details

ISBN 139781849696821
Paperback256 pages

About This Book

  • Create 2D reusable games using the new SDL 2.0 and C++ frameworks
  • Become proficient in speeding up development time
  • Create two fully-featured games with C++ which include a platform game and a 2D side scrolling shooter
  • An engaging and structured guide to develop your own game

Who This Book Is For

SDL Game Development is aimed at C++ developers who want to learn the fundamentals of SDL for cross-platform game development. This isn't a beginner's guide to C++, so a good knowledge of C++ and object oriented programming is a must.

Table of Contents

Chapter 1: Getting Started with SDL
Why use SDL?
Setting up SDL in Visual C++ Express 2010
Hello SDL
What makes up a game
The Game class
Summary
Chapter 2: Drawing in SDL
Basic SDL drawing
Source and destination rectangles
Installing SDL_image
Tying it into the framework
Summary
Chapter 3: Working with Game Objects
Using inheritance
Implementing polymorphism
Using abstract base classes
Should we always use inheritance?
Putting it all together
Summary
Chapter 4: Exploring Movement and Input Handling
Setting up game objects for movement
Creating fixed frames per second
Input handling
Summary
Chapter 5: Handling Game States
A simple way for switching states
Implementing finite state machines
Implementing menu states
Summary
Chapter 6: Data-driven Design
Loading XML files
Implementing Object Factories
Fitting the factory into the framework
Parsing states from an XML file
Loading the menu state from an XML file
Loading other states from an XML file
Summary
Chapter 7: Creating and Displaying Tile Maps
What is a tile map?
Getting familiar with the Tiled application
Parsing and drawing a tile map
Scrolling a tile map
Parsing object layers
Summary
Chapter 8: Creating Alien Attack
Using the SDL_mixer extension for sound
Setting up the basic game objects
Handling bullets
Dealing with collisions
Possible improvements
Summary
Chapter 9: Creating Conan the Caveman
Setting up the basic game objects
Possible additions
Summary

What You Will Learn

  • Draw in SDL and build the SDL_image extension
  • Develop reusable classes
  • Get to grips with game related object-oriented programming
  • Integrate a variety of user inputs into your games, such as joysticks or keyboards
  • Use factories that enable us to create objects dynamically at runtime
  • Create 2D maps through the use of tiles
  • Easily apply the framework to different game genres
  • Understand the scrolling of a tile map using the position of the player and collision detection

In Detail

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.

Authors

Table of Contents

Chapter 1: Getting Started with SDL
Why use SDL?
Setting up SDL in Visual C++ Express 2010
Hello SDL
What makes up a game
The Game class
Summary
Chapter 2: Drawing in SDL
Basic SDL drawing
Source and destination rectangles
Installing SDL_image
Tying it into the framework
Summary
Chapter 3: Working with Game Objects
Using inheritance
Implementing polymorphism
Using abstract base classes
Should we always use inheritance?
Putting it all together
Summary
Chapter 4: Exploring Movement and Input Handling
Setting up game objects for movement
Creating fixed frames per second
Input handling
Summary
Chapter 5: Handling Game States
A simple way for switching states
Implementing finite state machines
Implementing menu states
Summary
Chapter 6: Data-driven Design
Loading XML files
Implementing Object Factories
Fitting the factory into the framework
Parsing states from an XML file
Loading the menu state from an XML file
Loading other states from an XML file
Summary
Chapter 7: Creating and Displaying Tile Maps
What is a tile map?
Getting familiar with the Tiled application
Parsing and drawing a tile map
Scrolling a tile map
Parsing object layers
Summary
Chapter 8: Creating Alien Attack
Using the SDL_mixer extension for sound
Setting up the basic game objects
Handling bullets
Dealing with collisions
Possible improvements
Summary
Chapter 9: Creating Conan the Caveman
Setting up the basic game objects
Possible additions
Summary

Book Details

ISBN 139781849696821
Paperback256 pages
Read More