You are previewing Advanced 2D Game Development.
O'Reilly logo
Advanced 2D Game Development

Book Description

Get ready to build a complete, professional-quality 2D game engine from start to finish! "Advanced 2D Game Development" is your comprehensive guide to 2D game development using DirectX in the C++ programming language. Each chapter of the book covers one major component of the game engine, including 2D and 3D rendering, DirectInput, FMOD audio, game math, multi-threading, Lua scripting, and more, and the game engine is built upon chapter by chapter. Through the creation of the game engine, you'll learn step by step how to write solid code for multiple compilers, adding to the code as you work through each chapter. And every chapter includes an example game that illustrates the new techniques being taught. Perfect for game programming students and professionals alike, this book is your ultimate guide to awesome 2D game development.

Table of Contents

  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Building a 2D Game Engine
    1. Compiler Support
    2. DirectX SDK Support
    3. Why Do We Need an Engine?
    4. Creating the Engine Project
      1. Dev-C++ Project
      2. Visual C++ Project
      3. Engine Source Code
      4. Compiling the Engine Project
    5. Testing the Engine
      1. The TestEngine Source Code
      2. Dev-C++ Library Test Project
      3. Visual C++ Library Test Project
  5. 3D Rendering
    1. Rendering Basics
    2. Adding Rendering Support
    3. Adding Camera Support
    4. Adding Mesh Support
    5. Rendering Meshes
      1. Runtime Cubes
      2. Bouncing Balls
    6. Direct Lighting
      1. Directional Light
      2. Spot Light
      3. Point Light
      4. Creating Lights
  6. 2D Rendering
    1. Basic 2D Rendering
    2. Raising Happy Sprites
      1. Creating Vectors
        1. Vector3.h
        2. Vector3.cpp
      2. Testing Vector3
      3. Creating a Reusable Sprite Class
    3. Rendering Sprites with Transparency
      1. Color Key Transparency
      2. Alpha Channel Transparency
  7. Animation
    1. Animation Demo
    2. Sprite Rotation and Scaling
    3. Animation with Transforms
    4. Particles
  8. Input
    1. Keyboard Input
      1. DirectInput Device
      2. Initializing the Keyboard
        1. Setting the Data Format
        2. Setting the Cooperative Level
        3. Acquiring the Device
      3. Reading Key Presses
    2. Mouse Input
      1. Initializing the Mouse
      2. Reading the Mouse
    3. Engine Modifications
      1. Input Class
      2. Engine Changes
    4. Testing Keyboard and Mouse Input
  9. Audio
    1. Designing an Audio System
      1. What Is FMOD?
      2. Using the FMOD SDK
    2. Audio Classes
      1. Sample Class
      2. Audio Class
    3. Adding FMOD to the Game Engine
      1. Audio Test
  10. Entities
    1. Building an Entity Manager
      1. The Entity Class
      2. Modifying the Engine
      3. Modifying the Sprite Class
      4. Testing Sprites as Entities
      5. Modifying the Mesh Class
      6. Testing Meshes as Entities
  11. Fonts
    1. Creating a Font
    2. Loading and Rendering a Font
      1. Font Class
    3. Using the New Font Class
  12. Physics
    1. Collision Detection
      1. Automated Collision Detection
      2. Bounding Rectangle Collision Test
      3. Distance-Based Collision Test
  13. Math
    1. Math Class
      1. Math Class Header
      2. Math Class Implementation
      3. Math Test
      4. Linear Velocity
      5. Angle to Target
    2. Drop-Down Console
      1. Console Class
      2. Console Test
  14. Threading
    1. Introducing the POSIX Threads Library
      1. Installing POSIX Threads
      2. Using POSIX Threads
      3. Programming POSIX Threads
      4. ThreadDemo Program
    2. Threading the Game Engine
      1. Threaded Garbage Collection
      2. Testing the Newly Threaded Engine
  15. Scripting
    1. Introducing Lua
      1. Running Lua from the Command Prompt
    2. Lua and C++
      1. Lua Script Class
      2. Linking with the Lua Library
      3. Script Test
  16. Games
    1. Scrolling Example
    2. Blocks Game
    3. Alien Invaders
    4. Epilogue