Use your business data to your advantage with the help of Syncfusion’s new data science offerings. Discover how a custom big data solution can provide your company with valuable predictions about key market trends.

SDL Game Development

Starting

Shaun MitchellJune 2013

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.

$26.99

$44.99

RRP $26.99

RRP $44.99

eBook

Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 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.

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

Shaun Mitchell

Shaun Mitchell is a developer at a high profile online gaming company. He holds a BSc in Game Programming and Development from Qantm College / SAE Institute London. Shaun is also a moderator and active member of the <dream.in.code> programming community.

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.