diff --git a/src/main.cpp b/src/main.cpp index 710bffb..6dbfb94 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,7 @@ #include "gui.h" #include "state.h" +#include "notify.h" #define CLEAR_COLOR 0.0, 0.0, 0.0, 1.0 @@ -61,12 +62,14 @@ int main(int argc, char* argv[]) { // demo state auto config = Config::from_file("../config.toml"); auto state = DemoState(std::make_shared(config)); + auto inotify = NotifyService(); // set up a GUI state auto gui = Gui(&state); if (argc == 2) { auto proj = Project::fromFile(std::string(argv[1])); + inotify.watch(*proj); state.current_project = std::move(proj); } @@ -94,11 +97,12 @@ int main(int argc, char* argv[]) { glBindVertexArray(0); double t, t_prev, dt; + unsigned long frame_n = 0; glfwSetTime(0); t_prev = glfwGetTime(); while(!glfwWindowShouldClose(window) && state.running) { t = glfwGetTime(); dt = t - t_prev; t_prev = t; - + glfwPollEvents(); ImGui_ImplGlfwGL3_NewFrame(); @@ -135,8 +139,14 @@ int main(int argc, char* argv[]) { glfwSwapBuffers(window); + if ((frame_n % 10) == 0) { + inotify._poll(); + } + std::cout << std::flush; std::cerr << std::flush; + + frame_n++; } ImGui_ImplGlfwGL3_Shutdown(); @@ -144,4 +154,4 @@ int main(int argc, char* argv[]) { glfwDestroyWindow(window); glfwTerminate(); return 0; -} \ No newline at end of file +}