Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

print 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
", fps);
}

// put this function somewhere in main cycle
 
PREVIOUS NEXT
Tagged: #print #fps #sfml
ADD COMMENT
Topic
Name
6+6 =