• Main Page
  • Packages
  • Classes
  • Files
  • File List

C:/Doug/CSharp/XnaCollisionLib/XnaCollisionLib/Utils/FPSCounter.cs

Go to the documentation of this file.
00001 using System;
00002 using Microsoft.Xna.Framework;
00003 
00004 namespace XnaCollisionLib.Utils
00005 {
00006     public class FPSCounter
00007     {
00008         private float _Seconds;
00009         private int _Frames;
00010         private int _FPS;
00011 
00012         public FPSCounter()
00013         {
00014             _Seconds = 0;
00015             _Frames = 0;
00016             _FPS = 0;
00017         }
00018 
00019         public int FPS
00020         {
00021             get { return _FPS; }
00022         }
00023 
00024         public void Update(GameTime gameTime)
00025         {
00026             _Seconds += (float)gameTime.ElapsedGameTime.TotalSeconds;
00027             _Frames++;
00028             if (_Seconds >= 1)
00029             {
00030                 _FPS = _Frames;
00031                 _Frames = 0;
00032                 _Seconds = 0;
00033             }
00034         }
00035     }
00036 }

Generated on Thu Jul 15 2010 19:56:39 for XnaCollisionLib by  doxygen 1.7.0