| |
| |
Introduction | |
| |
| |
| |
Learning C# | |
| |
| |
| |
The History of C# | |
| |
| |
A Brief History of Computers | |
| |
| |
Machine and Assembly Languages | |
| |
| |
Portability | |
| |
| |
High-Level Languages Save the Day | |
| |
| |
Portability with Virtual Machines | |
| |
| |
.NET to the Rescue | |
| |
| |
Just In Time Compilation | |
| |
| |
Reduction Theory | |
| |
| |
The Future | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
The Basics | |
| |
| |
Why You Should Read This Chapter | |
| |
| |
Your First C# Program | |
| |
| |
Classes | |
| |
| |
The Entry Point | |
| |
| |
Hello, C#!! | |
| |
| |
Compiling and Running | |
| |
| |
The Basics | |
| |
| |
Basic Data Types | |
| |
| |
Operators | |
| |
| |
Variables | |
| |
| |
Constants | |
| |
| |
Typecasts | |
| |
| |
Branching | |
| |
| |
if Statements | |
| |
| |
Switch Statements | |
| |
| |
Short-Circuit Evaluation | |
| |
| |
Looping | |
| |
| |
while Loops | |
| |
| |
for Loops | |
| |
| |
do-while Loops | |
| |
| |
Break and Continue | |
| |
| |
Scoping | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
A Brief Introduction to Classes | |
| |
| |
Values versus References | |
| |
| |
Value Types | |
| |
| |
Reference Types | |
| |
| |
Basics of Structures and Classes | |
| |
| |
Creating Classes and Structures | |
| |
| |
Differences between Structures and Classes | |
| |
| |
Putting Functions in Your Classes and Structures | |
| |
| |
Constructors | |
| |
| |
Destructors | |
| |
| |
More Advanced Class Tricks | |
| |
| |
The Basics of Inheritance | |
| |
| |
Static Members | |
| |
| |
Properties | |
| |
| |
Enumerations | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
Advanced C# | |
| |
| |
Namespaces | |
| |
| |
Creating Namespaces | |
| |
| |
Using Namespaces | |
| |
| |
Namespace Aliasing | |
| |
| |
Polymorphism | |
| |
| |
Basic Polymorphism | |
| |
| |
Virtual Functions | |
| |
| |
Abstraction | |
| |
| |
Polymorphism and Functions | |
| |
| |
Objects | |
| |
| |
Arrays | |
| |
| |
A Basic Array Example | |
| |
| |
What Is an Array? | |
| |
| |
Inline Initialization | |
| |
| |
References versus Values | |
| |
| |
Inheritance and Arrays | |
| |
| |
Multidimensional Arrays | |
| |
| |
Another Kind of Loop | |
| |
| |
Strings | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
| |
One More C# Chapter | |
| |
| |
Interfaces | |
| |
| |
Interfaces versus Abstract Classes | |
| |
| |
Multiple Inheritance | |
| |
| |
Extending and Combining Interfaces | |
| |
| |
Exceptions | |
| |
| |
Exception Basics | |
| |
| |
Advanced Exception Topics | |
| |
| |
Delegates | |
| |
| |
Creating a Delegate | |
| |
| |
Chaining Delegates | |
| |
| |
Collections | |
| |
| |
The Array List | |
| |
| |
Hash Tables | |
| |
| |
Stacks and Queues | |
| |
| |
Other Collections | |
| |
| |
File Access | |
| |
| |
Streams | |
| |
| |
Readers and Writers | |
| |
| |
File Streams | |
| |
| |
Random Numbers | |
| |
| |
Seeds | |
| |
| |
Generating Numbers | |
| |
| |
Other Generation Techniques | |
| |
| |
Above and Beyond | |
| |
| |
The Preprocessor | |
| |
| |
Operator Overloading | |
| |
| |
Variable Parameter Lists | |
| |
| |
Unsafe Code | |
| |
| |
C# 2.0 Features | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
Game Programming in C# | |
| |
| |
| |
Setting Up a Framework | |
| |
| |
Creating a Project | |
| |
| |
SharpDevelop | |
| |
| |
Visual C# | |
| |
| |
Visual C#'s D3D Framework | |
| |
| |
The Advanced Framework | |
| |
| |
Have You Got the Time? | |
| |
| |
Problems with the Timer | |
| |
| |
Changes to the Framework | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
Direct3D | |
| |
| |
DirectX Versions | |
| |
| |
One Device to Rule Them All | |
| |
| |
It's All about Presentation | |
| |
| |
Buffers and Buffer Swapping | |
| |
| |
Creating a Device | |
| |
| |
The Manager | |
| |
| |
Updating the Framework | |
| |
| |
Setting Up a Device | |
| |
| |
Handling Multi-Tasking | |
| |
| |
Actually Drawing Stuff | |
| |
| |
Vertexes | |
| |
| |
Defining Some Vertexes | |
| |
| |
Final Touches | |
| |
| |
Colors and Alpha | |
| |
| |
Playing with Colors | |
| |
| |
Playing with Alpha | |
| |
| |
Another Demo | |
| |
| |
Texturing and Other Shapes | |
| |
| |
Texturing | |
| |
| |
Other Forms of Geometry | |
| |
| |
Demo 7.4 | |
| |
| |
Sprites | |
| |
| |
The Sprite Class | |
| |
| |
Making the Code Better | |
| |
| |
Demo 7.5 | |
| |
| |
Fonts | |
| |
| |
Creating a System Font | |
| |
| |
Drawing Text | |
| |
| |
Demo 7.6 | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
DirectInput | |
| |
| |
Keyboards | |
| |
| |
Creating a Device | |
| |
| |
Gathering Input by Polling | |
| |
| |
Mice | |
| |
| |
Creating a Mouse | |
| |
| |
Polling a Mouse | |
| |
| |
Game Devices | |
| |
| |
Finding a Game Device | |
| |
| |
Creating a Game Device | |
| |
| |
Getting Joystick Axis Data | |
| |
| |
Modifying Axis Attributes | |
| |
| |
More Joystick Data | |
| |
| |
Demo 8.3: Joysticks | |
| |
| |
Force Feedback | |
| |
| |
The Effect Editor | |
| |
| |
Loading Effects | |
| |
| |
Playing Effects | |
| |
| |
Stopping Effects | |
| |
| |
Demo 8.4 | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
DirectSound | |
| |
| |
The Sound Device | |
| |
| |
Sound Buffers | |
| |
| |
Playing Buffers | |
| |
| |
Buffer Descriptions | |
| |
| |
Demo 9.1 | |
| |
| |
Sound Effects | |
| |
| |
Sound in 3D | |
| |
| |
3D Buffers | |
| |
| |
Additional 3D Topics | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
| |
Putting Together a Game | |
| |
| |
Setting Up a Design | |
| |
| |
The Game Genre | |
| |
| |
Deciding How the Game Works | |
| |
| |
The Universe | |
| |
| |
The Actors | |
| |
| |
The Data | |
| |
| |
Spaceships | |
| |
| |
Weapons | |
| |
| |
Projectiles | |
| |
| |
Powerups | |
| |
| |
Common Attributes | |
| |
| |
A New Framework | |
| |
| |
Setting Up | |
| |
| |
Device Options | |
| |
| |
Device Blocks | |
| |
| |
Input Checkers | |
| |
| |
Joysticks | |
| |
| |
Game States | |
| |
| |
State Changes | |
| |
| |
A Sample State | |
| |
| |
The Game Class | |
| |
| |
Generic Space Shooter 3000 | |
| |
| |
Game Objects | |
| |
| |
The States for GSS3K | |
| |
| |
The Help State | |
| |
| |
The Game State | |
| |
| |
Playing GSS3K | |
| |
| |
The Future | |
| |
| |
3D Worlds | |
| |
| |
Advanced Collision Detection | |
| |
| |
Artificial Intelligence | |
| |
| |
Networking | |
| |
| |
Advanced Storage | |
| |
| |
Summary | |
| |
| |
What You Learned | |
| |
| |
Review Questions | |
| |
| |
On Your Own | |
| |
| |
Conclusion | |
| |
| |
| |
Appendixes | |
| |
| |
| |
Answers to Review Questions | |
| |
| |
Chapter 1: The History of C# | |
| |
| |
Chapter 2: The Basics | |
| |
| |
Chapter 3: A Brief Introduction to Classes | |
| |
| |
Chapter 4: Advanced C# | |
| |
| |
Chapter 5: One More C# Chapter | |
| |
| |
Chapter 6: Setting Up a Framework | |
| |
| |
Chapter 7: Direct3D | |
| |
| |
Chapter 8: DirectInput | |
| |
| |
Chapter 9: DirectSound | |
| |
| |
Chapter 10: Putting Together a Game | |
| |
| |
| |
Setting Up DirectX and .NET | |
| |
| |
The .NET Framework | |
| |
| |
The .NET SDK | |
| |
| |
Integrated Development Environments | |
| |
| |
Managed DirectX | |
| |
| |
Setting Up References | |
| |
| |
Index | |