Wydrukuj FPS SFML

void print_fps(){
  static sf::Clock clock; // google "static with variables", if you need
  static sf::Time last_time = clock.getElapsedTime();
  sf::Time current_time = clock.getElapsedTime();
  float fps = 1.f / (current_time.asSeconds() - last_time.asSeconds());
  last_time = current_time;

  printf("FPS: %f\n", fps);
}

// put this function somewhere in main cycle
zen iiop