Skip to content

Instantly share code, notes, and snippets.

@KAYLukas
Created June 27, 2012 12:35
Show Gist options
  • Save KAYLukas/3003815 to your computer and use it in GitHub Desktop.
Save KAYLukas/3003815 to your computer and use it in GitHub Desktop.
new fps implementation
double frame(){
double t = glfwGetTime();
static double oldt;
double dt = t - oldt;
oldt = t;
static double time_between_frames;
//Determine the weight on the amount of fps, so that every second always has a equal weight.
int weight = (int) (1.0/time_between_frames);
weight /= 10;
if(weight < 3){
weight = 3;
}
time_between_frames = (weight*time_between_frames + dt)/(weight+1);
return 1.0/time_between_frames;
}
@FerryT
Copy link

FerryT commented Jul 1, 2012

Ik denk dat het wel veilig is om de timing naar doubles om te zetten. De aanpassingen voor de serializatie zijn nog wel te doen. Let op FRATE, ElapsedTime en de FPS class. Deze moeten aangepast worden om met het nieuwe systeem te werken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment