Show Timer.h syntax highlighted
/**
**************************************************************************************
*Palisma - Secrets of the Illuminati is an open-source 2D RPG *
*Copyright (C) 2006, Tony Sparks *
* *
*This library is free software; you can redistribute it and/or *
*modify it under the terms of the GNU Lesser General Public *
*License as published by the Free Software Foundation; either *
*version 2.1 of the License, or (at your option) any later version. *
* *
*This library is distributed in the hope that it will be useful, *
*but WITHOUT ANY WARRANTY; without even the implied warranty of *
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
*Lesser General Public License for more details. *
* *
*You should have received a copy of the GNU Lesser General Public *
*License along with this library; if not, write to the Free Software *
*Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
**************************************************************************************
*/
#pragma once
#include "mmanager.h"
#include <math.h>
#include <stdio.h>
#if WIN32
#if _MSC_VER
#include <windows.h>
#else
#error Unknown Compiler
#endif
#endif
class Timer
{
public:
Timer(void);
void Pause();
void UnPause();
int Refresh();
virtual double GetFrameTime() {return m_frametime;};
virtual double GetTime() {return m_time;};
double GetPauseTime() { return m_pauseTime; };
int GetNumFrames() { return m_frames; };
private:
double m_time; // time since windows started (s)
double m_pauseTime; // time when the timer was paused
double m_lastTime; // last recorded time
double m_frametime; // time elapsed in the last frame (s)
int m_frames; // number of frames
LARGE_INTEGER m_frequency;
double m_resolution;
bool m_paused;
int m_lowshift;
BYTE m_performanceTimerEnabled;
unsigned int m_oldTime;
int m_sametimecount; // counter for frames with the same time.
public:
virtual ~Timer(void);
};
See more files for this project here