diff --git a/src/main.cpp b/src/main.cpp index 8a65103..992a39c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,8 @@ #include #include +#include + // INPUT! // // what input do we even want in the first place? @@ -84,6 +86,12 @@ void clearInput() input.cycleAnimation = false; } +double getTime() +{ + auto now = std::chrono::steady_clock::now().time_since_epoch(); + return std::chrono::duration(now).count(); +} + int main() { GLFWwindow* window = nullptr; @@ -120,7 +128,8 @@ int main() const int ANIM_ORBITING = 0; const int ANIM_ECCENTRICITY = 1; int animation = 0; - float time = glfwGetTime(); + + double time = getTime(); // Main loop while (!glfwWindowShouldClose(window)) @@ -141,13 +150,14 @@ int main() } // only update time if playing the orbiting animation + const double speed = 0.5; if (animation == ANIM_ORBITING) { - time = glfwGetTime(); + time = getTime() * speed; } else { - float e = .25 + .2 * sin(glfwGetTime()); + double e = .25 + .2 * sin(getTime()); orbit.setEccentricity(e); }