Adding an Frames Per Second counter

This is a very short and quick post. In your “Game1” class, locate your “Update” method. Before the base.Update(gameTime);, add the following:

// Output Frames Per Second
double fps = (1000 / gameTime.ElapsedGameTime.TotalMilliseconds);
fps = Math.Round(fps, 0);
Window.Title = "Project Vanquish " + fps.ToString() + " FPS";

This will update the Game Windows title with the Frames Per Second. It should sit at 60, dependent on the power of your PC. If you want to see this update in real-time, then in your “Game1” constructor, add the following:

this.IsFixedTimeStep = false;

This stops the update syncing with the V-Sync of the monitor.

The next post we’ll be implementing shadows. It will be a multi-part post as there is a lot to do in order to get it working.