CFPSCounter.h 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright (C) 2002-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef __C_FPSCOUNTER_H_INCLUDED__
  5. #define __C_FPSCOUNTER_H_INCLUDED__
  6. #include "irrTypes.h"
  7. namespace irr
  8. {
  9. namespace video
  10. {
  11. class CFPSCounter
  12. {
  13. public:
  14. CFPSCounter();
  15. //! returns current fps
  16. s32 getFPS() const;
  17. //! returns primitive count
  18. u32 getPrimitive() const;
  19. //! returns average primitive count of last period
  20. u32 getPrimitiveAverage() const;
  21. //! returns accumulated primitive count since start
  22. u32 getPrimitiveTotal() const;
  23. //! to be called every frame
  24. void registerFrame(u32 now, u32 primitive);
  25. private:
  26. s32 FPS;
  27. u32 Primitive;
  28. u32 StartTime;
  29. u32 FramesCounted;
  30. u32 PrimitivesCounted;
  31. u32 PrimitiveAverage;
  32. u32 PrimitiveTotal;
  33. };
  34. } // end namespace video
  35. } // end namespace irr
  36. #endif