Programming 2D Games

Free Standard Shipping

Purchasing Options

ISBN 9781466508682
Cat# K14701



SAVE 20%

eBook (VitalSource)
ISBN 9781466508729
Cat# KE16273



SAVE 30%

eBook Rentals


  • Focuses on 2D programming techniques such as collision detection
  • Takes students through the process of creating a game engine, demonstrating the advantages of using an engine to develop a complete game
  • Presents the latest DirectX and Windows coding methods using C++
  • Includes questions and programming exercises at the end of each chapter
  • Provides thoroughly tested example programs and a discussion forum on the book’s website

PowerPoint slides available with qualifying course adoption


A First Course in Game Programming
Most of today’s commercial games are written in C++ and are created using a game engine. Addressing both of these key elements, Programming 2D Games provides a complete, up-to-date introduction to game programming. All of the code in the book was carefully crafted using C++. As game programming techniques are introduced, students learn how to incorporate them into their own game engine and discover how to use the game engine to create a complete game.

Enables Students to Create 2D Games
The text covers sprites, animation, collision detection, sound, text display, game dashboards, special graphic effects, tiled games, and network programming. It systematically explains how to program DirectX applications and emphasizes proper software engineering techniques. Every topic is explained theoretically and with working code examples. The example programs for each chapter are available at

Table of Contents

Getting Started
The Development Environment
What Is DirectX?
Why C++?
Naming Conventions 
Game Engine
Tips and Tools

Windows Programming Fundamentals
Windows Programming Fundamentals
"Hello World" Windows Style
Device Context
Keyboard Input with Windows API
Using a Mutex to Prevent Multiple Instances 
Multitasking in Windows

Introduction to DirectX
Introduction to DirectX
Initializing DirectX
Creating a Device
Clearing a Display Buffer
Page Flipping
A Clean Exit
The Graphics Class
Our First DirectX Program
Fullscreen or Windowed
Debug vs. Retail DLLs
Determining Device Capabilities

The Game Engine
The Game Engine, Part 1
The Game Class
The Input Class
The Spacewar Class

Sprites and Animation
Obtaining Game Graphics
The Graphics Pipeline
Drawing with Transparency
The TextureManager Class
The Image Class
Game Engine
Simple Animation

Collisions and Entities
The Entity Class
Physics for 2D Games

Obtaining Audio Files
Creating Audio Files
Using XACT
Adding Audio to the Game Engine
Adding Sound to the Game
Adjusting Audio Playback 

Sprite Text
Creating Custom Fonts
Text Class Details
DirectX Text
TextDX Class Details 
Adding an FPS Display 
Adding a Console
Console Class
Incorporating the Console into the Game Engine

Enhanced Appearance
Bitmap Scrolling
Painter's Algorithm
Parallax Scrolling 
Shadows and Reflections
Message Dialog
Input Dialog
Windows Dialogs in Fullscreen DirectX Applications

Tiled Games
Why Tiled?
Creating a Tile Set
Creating Levels
Displaying the Tiles
Orthogonal Projection
Oblique Projection
Isometric Projection
Isometric Terrain
Elevation Layers 

Building a Complete Game
Evolutionary Prototyping  
Project Management
Design Document 
Prototype Textures 
Spacewar Tasks
Spacewar v1.0
Saving and Loading 

Network Programming
Network Overview
The Net Class
Initialize the Network
Creating a Server
Creating a Client
Get the Local IP Address
Closing a Socket
Get Error
Client/Server Chat
Client/Server Spacewar
Spacewar Server
Spacewar Client

The Journey


Questions and Exercises appear at the end of each chapter.

Author Bio(s)