refactor: use GLFW time

This removes the requirement for std::chrono
This commit is contained in:
Cat Flynn 2023-07-31 22:33:33 +02:00
parent 4400839ae1
commit c44624f51e
1 changed files with 1 additions and 11 deletions

View File

@ -42,19 +42,9 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <chrono>
#include "gfx.hpp" #include "gfx.hpp"
#include "triangle.hpp" #include "triangle.hpp"
std::chrono::steady_clock::time_point startTime = std::chrono::steady_clock::now();
float getTime()
{
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
std::chrono::duration<float> timeSpan = std::chrono::duration_cast<std::chrono::duration<float>>(now - startTime);
return timeSpan.count();
}
#include <cmath> #include <cmath>
#include "astro/twoBodyMethods.hpp" #include "astro/twoBodyMethods.hpp"
@ -114,7 +104,7 @@ int main()
glClearColor(0.2, 0.3, 0.3, 1.0); glClearColor(0.2, 0.3, 0.3, 1.0);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
triangle.render(getTime()); triangle.render(glfwGetTime());
glfwSwapBuffers(window); glfwSwapBuffers(window);
glfwPollEvents(); glfwPollEvents();