32 lines
533 B
C++
32 lines
533 B
C++
#ifndef FrameCounter_h__
|
|||
|
|
#define FrameCounter_h__
|
||
|
|
|
||
|
|
namespace LifeCore
|
||
|
|
{
|
||
|
|
class Timer;
|
||
|
|
class FrameCounter
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
FrameCounter();
|
||
|
|
~FrameCounter();
|
||
|
|
int GetFrameId();
|
||
|
|
float GetFps();
|
||
|
|
float GetFpsAvg();
|
||
|
|
float GetTimeElapled();
|
||
|
|
float GetTimeElapsedAvg();
|
||
|
|
void SetFrameRange(int range);
|
||
|
|
void OnFrameEnd();
|
||
|
|
private:
|
||
|
|
float* prev_time;
|
||
|
|
int buffer_pos;
|
||
|
|
float fps;
|
||
|
|
float avg_fps;
|
||
|
|
float time_elapsed;
|
||
|
|
float time_elapsed_avg;
|
||
|
|
int frame_range;
|
||
|
|
int frame_id;
|
||
|
|
Timer* timer;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif // FrameCounter_h__
|