Changeset 8fbd34f in opengl-game for new-game.cpp


Ignore:
Timestamp:
Jan 10, 2019, 7:56:49 PM (6 years ago)
Author:
dportnoy15 <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
fe5e3ca
Parents:
adb104f
Message:

Create a work-around for the OSX Sierra vsync issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • new-game.cpp

    radb104f r8fbd34f  
    207207#define NUM_KEYS (512)
    208208#define ONE_DEG_IN_RAD ((2.0f * M_PI) / 360.0f) // 0.017444444 (maybe make this a const instead)
     209#define TARGET_FPS 60.0f
    209210
    210211const int KEY_STATE_UNCHANGED = -1;
     
    673674      double current_seconds = glfwGetTime();
    674675      double elapsed_seconds = current_seconds - previous_seconds;
     676
     677      // temporary code to get around vsync issue in OSX Sierra
     678      if (elapsed_seconds < (1.0f / TARGET_FPS)) {
     679        continue;
     680      }
     681
    675682      previous_seconds = current_seconds;
    676683
Note: See TracChangeset for help on using the changeset viewer.