diff --git a/src/main.cpp b/src/main.cpp index e386021f361c167ef7e7fa55c2ef8457822edba0..f08ed0468da33df1f5ed7ea8d063f6abb9d620cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include <glad/glad.h> #include <GLFW/glfw3.h> #include <common/manager.hpp> +#include <thread> int main() { @@ -25,16 +26,15 @@ int main() if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) return -1; + /* Move ComponentManger to its own thread for maximum performance. */ ComponentManager manager; + std::thread thread([&]() { while (true) { manager.tick(); } }); while (!glfwWindowShouldClose(window)) { if(glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, true); - /* Update all the components (CPU, GPU, DMA) */ - manager.tick(); - glClearColor(0.2f, 0.3f, 0.3f, 1.0f); glClear(GL_COLOR_BUFFER_BIT);