fork(1) download
  1. #include <chrono>
  2.  
  3. void calculate_next_physical_frame(){
  4. //TODO: add logic to move objects around
  5. }
  6. void display_current_frame_to_screen(){
  7. //TODO: add logic to display objects to screen
  8. }
  9.  
  10. int main(){
  11. auto current_time = std::chrono::high_resolution_clock::now();
  12. const auto physical_frame_length = std::chrono::milliseconds{1000/60};
  13. for (;;){
  14. while (std::chrono::high_resolution_clock::now() - current_time > physical_frame_length){
  15. calculate_next_physical_frame();
  16. current_time += physical_frame_length;
  17. }
  18. display_current_frame_to_screen();
  19. }
  20. }
  21.  
Time limit exceeded #stdin #stdout 5s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty