#include "cache.h"


double LastAllegroTime;
double DeltaTime;
double SecondDelay=0;

double FPS=0;
int FramesUpdated;

void UpdateDelta() {
  DeltaTime = al_current_time() - LastAllegroTime;
  DeltaTime /= ALLEGRO_BPS_TO_SECS(60);
  LastAllegroTime = al_current_time();

  if ((al_current_time()-SecondDelay) > 1) {
    SecondDelay = al_current_time();
    FPS = FramesUpdated;
    FramesUpdated = -1;
  }

  if (DeltaTime > 4) DeltaTime=2;
}

void ResetDelta() {
  LastAllegroTime = al_current_time();
  DeltaTime=1.0;
}
