Introduction to Game Programming in C++

Introduction to Game Programming in C++

by Alan Thorn
ISBN-10:
1598220322
ISBN-13:
9781598220322
Pub. Date:
05/29/2007
Publisher:
Jones & Bartlett Learning
ISBN-10:
1598220322
ISBN-13:
9781598220322
Pub. Date:
05/29/2007
Publisher:
Jones & Bartlett Learning
Introduction to Game Programming in C++

Introduction to Game Programming in C++

by Alan Thorn

Paperback

$47.95
Current price is , Original price is $47.95. You
$47.95 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores
  • SHIP THIS ITEM

    Temporarily Out of Stock Online

    Please check back later for updated availability.


Overview

Introduction to Game Programming with C++ explores the world of game development with a focus on C++. This book begins with an explanation of the basics of mathematics as it relates to game programming, covers the fundamentals of C++, and describes a number of algorithms commonly used in games. In addition, it discusses several libraries that can help you manage graphics, add audio, and create installation software so you can get started on the path to making both 2D and 3D games. With this book understand the basics of programming in C++, including working with variables, constants, arrays, conditional statements, pointers, and functions; learn how to use the ClanLib library to make 2D games; discover how the OGRE graphics library can be used to implement particle systems and other effects in 3D games; find out how to integrate sound and music into your game.

Product Details

ISBN-13: 9781598220322
Publisher: Jones & Bartlett Learning
Publication date: 05/29/2007
Series: Wordware Game Developer's Library
Edition description: 1E
Pages: 367
Product dimensions: 6.30(w) x 8.97(h) x 0.79(d)

About the Author

Alan Thorn is an independent game developer, mathematician, and freelance programmer with more than 11 years of industry experience. He currently works as a consultant for some of the largest corporations in the entertainment and leisure arena, helping to deliver interactive DVDs, content management systems, and artificially intelligent software. He is also the author of Introduction to Game Programming with C++, DirectX9 User Interfaces: Design and Implementation, and DirectX 9 Graphics: The Definitive Guide to Direct 3D.

Table of Contents


Acknowledgments     xvii
Introduction     xix
Mathematics - The Language of Numbers     1
Number Systems     2
Decimal System (Base 10)     3
Arithmetic     4
Addition     4
Subtraction     4
Multiplication     4
Division     5
Number Parts     5
Dividing into Parts and Several Parts     6
Special Numbers     7
Ratio     8
Ratio and Proportion     9
Corresponding Proportion or Alternate Proportion     9
Ratios and Common Multipliers     10
Ratios and Common Divisors     10
Inverse Proportion     10
Solving Problems with Ratios     11
Discrete and Continuous Sets     12
Fractions - Incomplete Measure     13
Unit and Reciprocal Fractions     15
Fractions and Whole Numbers     16
Complements     16
Equivalents     17
Comparing Fractions     18
Adding and Subtracting Fractions     20
Multiplying and Dividing Fractions     20
Decimal Notation - Damn Those Dots     22
Converting Vulgar Fractions to Decimals     23
Percentage     24
As Ratio     24
Percent as Fractions     25
Percent Of     25
Conclusion     26
Algebra     27
What Is Algebra?     28
Rules of Algebra     28
Parentheses     28
Multiplication and Factors     29
Distributive Multiplication     29
Division and Multiplication     30
Multiplication Notation     30
Indices or Exponents     30
Directed Numbers     32
Addition with Negatives     32
Subtraction with Negatives     33
Multiplication with Negatives     33
Division with Negatives     33
Algebraic Expressions     34
Coefficients     34
Like Terms     34
Collect Like Terms     35
Linear Equations     35
Rearranging Equations     36
Balancing Equations     37
Balancing Methods     38
Simplification     39
Inequalities     40
Expressing Inequalities     40
Compound Inequalities      41
Chained/Continued Inequalities     41
Solving Inequalities     41
Simultaneous Linear Equations     43
Solving by Substitution     43
Solving by Elimination     44
Conclusion     46
The Pictures of Mathematics     47
1D Coordinates     48
2D Coordinates     48
3D Coordinates     49
Primitives and Properties of Space     50
Vertices     50
Lines and Line Segments     50
Ray     51
Angle     51
Perpendicular     51
Angle Types     52
Parallel     52
Polygons and Shapes     53
Triangles     54
Squares     55
Area and Perimeter     55
Square Numbers and Square Roots     56
Right Triangles and the Pythagorean Theorem     57
Right Triangles and Angles     58
Sides, Angles, and Ratios     59
Angle and Side Correspondence     60
Side Lengths     61
Co Functions     61
Area of a Triangle     62
The Circle     63
Chords      64
Central and Inscribed Angles     64
Length of a Chord     65
Pi ([pi])     65
Radians     66
Equations of Lines     67
X and Y Intercept     68
Gradients (Slopes)     68
Slope Intercept Equation     69
Vectors     69
Vector Magnitude     70
Unit Vector     70
Conclusion     70
C++ and Programming     71
Programming     72
C++ as a Language     73
C++ IDE     73
Microsoft Visual Studio.NET     74
Code::Blocks     75
Dev C++     75
Using an IDE     77
Projects     77
Starting a New Visual C++ Project     78
Starting a New Code::Blocks Project     79
Starting a New Dev C++ Project     81
Project Types     81
Coding     82
Compiling     83
Compiling on Visual Studio     83
Compiling on Code::Blocks     84
Compiling on Dev C++     85
Executing     85
Executing on Visual Studio     86
Executing on Code::Blocks     86
Executing on Dev C++     87
Debugging     87
Debugging on Visual Studio .NET     88
Debugging on Code::Blocks     88
Debugging on Dev C++     89
Opening and Saving Projects     90
Conclusion     90
The Basics of C++     91
The First Program     92
Comments     93
Preprocessor Directives     94
Functions     94
Printing Text     95
Conclusion     95
Variables, Constants, and Arrays     97
Constants     98
Variables     98
Data and Information     98
Data in Memory     99
Constants and Variables in Memory     100
Data Types     101
Integers     101
Floats     101
Boolean     101
Char     102
Constants in C++     102
Variables in C++     103
Arithmetic Operators     104
Outputting Results     105
Data and Arrays     106
Array Definition     106
Array Declaration     107
Array Usage     107
Two-dimensional Arrays     108
Shorthand Operations     108
Conclusion     109
Controlling Program Flow     111
Handling Input     112
Making Decisions     112
Conditional Operators     113
Conditional Statements     114
If Statement     114
Using If     115
If Else Statement     115
Using If Else     116
Logical Operators     117
If Else Statements and Logical Operators     117
Multiple Choice     119
Switch-Case Statement     120
Loops and Repetition     121
For Loop     121
Using For Loops     122
While Loop     122
Using the While Loop     123
Do-While Loop     124
Using the Do-While Loop     125
Conclusion     126
Pointers     127
Memory Addresses     128
Pointers     128
Declaring Pointers     129
Address Of     129
Pointer Dereferencing     130
Pointer Arithmetic     130
Pointers and Arrays      131
Using Pointers and Arrays     131
Conclusion     132
Functions     133
Functions in Mathematics     134
Function Notation     134
Functions in C++     135
Coding Functions     135
Calling Functions     137
Functions as Arguments     138
Functions without Inputs and Outputs     139
Functions and Variables     140
Variable Scope     140
Global, Local, and Block Variables     141
Functions and Arguments as Pointers     144
Recursive Functions     145
Functions and Default Arguments     146
Functions and Overloading     147
Conclusion     148
Data Structures and Classes     149
Organizing Data     150
Data Structures     150
Declaring Data Structures     151
Data Structures as Blueprints     151
Data Structures and Members     152
Data Structures and Size     153
Further Data Representation     153
Classes and Object Orientation     154
Classes as Objects     154
Classes and Objects      156
Access Specifiers     156
Classes and Access Specifiers     157
Private and Public     158
Constructors and Destructors     159
Overloading Operators     159
Overloading Operators in Practice     160
Inheritance     162
Class Inheritance     162
Multiple Inheritance     163
Pointers to Classes     164
This Pointer     164
Overriding Functions     165
Polymorphism     166
Polymorphism and Virtual Functions     166
Conclusion     168
Memory Allocation and Strings     169
Memory Allocation     170
New Keyword     170
Delete Keyword     171
Dynamic Arrays     172
Strings     172
Strings with std::string     174
Creating std::string Objects     174
Using Strings and the + Operator     174
String Methods     175
String Length     175
String Conversion     176
Inserting Characters     176
Substrings     177
Erase     177
Replace      178
String Processing     178
Cycling through a String     178
Cycling Backward through a String     179
Reversing a String     180
Conclusion     181
File I/O and Command-Line Arguments     183
Files     184
Reading and Writing Files     185
Writing Data to Files with std::ofstream     185
Creating Files     186
Opening Files     186
Writing Data to Files     186
Reading Data from Files with std::ifstream     187
Opening Files     187
Reading Data     187
Seeking Data     188
Command-Line Arguments     190
Conclusion     191
Algorithms     193
Language and Content     193
Common Algorithms     195
Bubble Sort     195
Linked Lists     197
Stacks - Pop and Push     204
Binary Heaps     205
A Breakdown     206
Child and Parent     206
Pushing Items     207
Popping Items     210
Application     212
Conclusion     216
Game Programming      217
Game Development     218
Software Abstraction     219
Graphics     219
DirectX     221
OpenGL     222
Other Libraries     222
SDL     223
ClanLib     223
OGRE 3D (Object-Oriented Graphics Rendering Engine)     223
A Sound and Music     224
OpenAL     224
FMOD     225
BASS     225
More Middleware     225
ODE (Open Dynamics Engine)     226
Nullsoft Scriptable Install System     226
Conclusion     227
2D Games and ClanLib     229
ClanLib     230
Downloading ClanLib     230
Building ClanLib     231
First ClanLib Application     232
Include Files     232
Creating an Application Class     233
Overriding the Main Method     233
Initializing Game Objects     234
Initializing Game Window     234
Games and the Message Loop     236
Graphics Rendering     238
Conclusion     239
ClanLib - Core Classes     241
2D Games and Images      242
Surfaces     242
Drawing Surfaces     244
Drawing a Surface in a Rectangle     245
Drawing a Rectangular Selection from a Surface in a Rectangle     246
Drawing a Surface Repeatedly     246
Transformation     247
Scale     247
Rotation     248
Color     248
Alpha     249
XML     249
XML Defined     249
Nodes and Elements     251
Creating and Saving XML Using ClanLib     251
Create an XML Document     251
Create a Root Element     251
Create Other Elements and Set Attributes     252
Build the XML Hierarchy     252
Save the XML Hierarchy to a File     252
Load XML Using ClanLib     252
Load an XML File into a Hierarchy     252
Get the Root Element     253
Resources     253
Resource XML Files     254
Creating Surfaces from Resources     254
Sprites     255
Defining Sprites in XML     256
Creating Sprite Objects     257
Drawing Sprite Objects     257
Input      258
Reading Input from the Keyboard     258
Reading Input from the Mouse     258
Determine Cursor Position     258
Determine Button Status     259
Conclusion     259
ClanLib - Scene Management     261
Scenes     262
Scenes and Design     262
Scene Implementation     264
Scene Manager - Core Properties     264
Scene Manager - Scene Objects     265
Scene Manager - Object Relationships     266
Layers     268
Implementing Layers     269
Layer Scene Objects     270
Adding Scene Objects     272
Cycling through Objects     272
Deleting Scene Objects     272
Painting a Layer     273
Painting to a Surface     273
CL_SceneLayer - Painting     274
CL_SceneManager - Structure     275
CL_SceneManager - XML     275
CL_SceneManager - Load from XML     277
Overview - Using Scene Manager     279
Creating the Scene Manager Manually     280
Creating the Scene Manager from XML     281
Conclusion     282
3D Games and OGRE 3D      283
3D Games     284
OGRE 3D     285
Downloading OGRE 3D     286
Installing OGRE 3D     287
Compiling the OGRE 3D Samples     288
Running the OGRE 3D Samples     289
Creating an OGRE Application Using a Wizard     289
Creating an OGRE Application Manually     293
Creating a Main Function     293
Deriving from ExampleApplication     293
Running OGRE Applications     294
Creating a Scene     297
OGRE Log     299
OGRE Documentation     299
Conclusion     300
Exploring OGRE 3D     301
3D Scenes     302
Entities     302
Scene Nodes     303
Creating 3D Scenes     303
Create Entity     304
Create SceneNode     304
SceneNode Properties and Methods     305
Lights     306
Ambient Light     306
Point Light     307
Spotlight     307
Directional Light     307
Cameras     307
Materials and Scripts     309
Billboards     311
Creating Billboards     312
Particle Systems     313
Scripted Particle Systems     314
Loading Particle Systems     316
Frame Listeners     317
Registering Frame Listeners     318
Input     320
Keyboard Input     321
Mouse Input     321
Conclusion     321
Other Gaming Libraries - Install and Sound     323
Sound and Music     324
FMOD     324
Installing and Configuring     327
Playing Sound and Music     327
BASS     328
Installing and Configuring     329
Playing Sound and Music     329
NSIS -Windows Installer     330
Scripted Installs     331
Writing a Script     332
Compiling a Script     335
Running an Installer     335
Scripting     336
Open-Source Software     336
Open Media Formats     337
Conclusion     337
Afterword     339
Trigonometric Table     341
Degrees to Radians     345
ClanLib Key Codes     347
OGRE Key Codes      351
C++ Keywords     357
Recommended Reading     359
Index     363
From the B&N Reads Blog

Customer Reviews