Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
OpenGL-SDL-Code-Warehouse/FPSLimit.hpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
28 lines (24 sloc)
624 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* \file FPSLimit.hpp | |
* \brief FPS Limiter. | |
* | |
* This class automatically limits the frames per second of a game loop, and it | |
* provides performance warnings to stdout if the framerate is less than the | |
* desired value. | |
*/ | |
#ifndef __FPSLIMIT_H__ | |
#define __FPSLIMIT_H__ | |
#ifdef __APPLE__ | |
#include "SDL.h" | |
#else | |
#include "SDL/SDL.h" | |
#endif | |
class FPSLimit { | |
public: | |
FPSLimit( int desiredFPS ); | |
void Regulate(); | |
private: | |
Uint32 lastTime; //!< The SDL timestamp received last call to Regulate. | |
Uint32 numMillis; //!< The number of milliseconds per frame. | |
}; | |
#endif |