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