svvitch
digital signage player
D:/vs_workspace/switch_sf/src/svvitch/FPSCounter.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include "PerformanceTimer.h"
00004 
00005 
00010 class FPSCounter: public PerformanceTimer
00011 {
00012 private:
00013     Uint32 _count;
00014     Uint32 _fps;
00015 
00016     void calculation() {
00017         DWORD time = getTime();
00018         if (time >= 1000) {
00019             _fps = _count;
00020             _count = 0;
00021             update();
00022         }
00023     }
00024 
00025 public:
00026     FPSCounter():PerformanceTimer() {
00027         start();
00028     }
00029 
00030     virtual ‾FPSCounter() {
00031     }
00032 
00033     virtual void start() {
00034         PerformanceTimer::start();
00035         _count = 0;
00036         _fps = 0;
00037     }
00038 
00039     void count() {
00040         _count++;
00041     }
00042 
00043     const Uint32 getFPS() {
00044         calculation();
00045         return _fps;
00046     }
00047 };
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines