Adding Frame Rate Output

One more of the many things the sample framework does is keep track of the game's frame rate. Frame rate is something that most 3D games closely track because it deals directly with the performance of the game. It is simply the number of frames rendered in any given second, and the framework calculates it using the high-resolution timer discussed earlier in this chapter.

The code included on the CD only displays the frame rate in debug mode so it doesn't clutter the screen in full-screen mode. Therefore, the code in this section assumes this behavior as well. Add the following variable to your game engine class declarations:

#if (DEBUG)
private Direct3D.Font debugFont = null;
#endif

The first thing you'll notice here ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.