Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Cpp :: vector<intv[] 
Cpp :: c++ get data type 
Cpp :: c++ count vector elements 
Cpp :: max c++ 
Cpp :: c++ recorrer string 
Cpp :: cmd color text c++ 
Cpp :: find the graph is minimal spanig tree or not 
Cpp :: intlen in c++ 
Cpp :: potato 
Cpp :: how to pass an array by reference in c++ 
Cpp :: c++ program to convert fahrenheit to celsius 
Cpp :: Character cin(userInput) in c++ 
Cpp :: has substr c++ 
Cpp :: 2d array of zeros c++ 
Cpp :: c++ define array with values 
Cpp :: erase range vector c++ 
Cpp :: c++ string to char* 
Cpp :: c++ function pointer 
Cpp :: how to create a struct in c++ 
Cpp :: unique element in array in c 
Cpp :: operator overloading c++ 
Cpp :: linkedlist in c++ 
Cpp :: check if cin got the wrong type 
Cpp :: recuva recovery software for pc with crack 
Cpp :: end vs cend in cpp 
Cpp :: Bit Tricks for Competitive Programming c ++ 
Cpp :: strcmp in c++ header file 
Cpp :: true false operator 
Cpp :: long, long long 32 bit or 8 bit in c++ 
Cpp :: +905344253752 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =