From 34052b51e00c939a35294d7085cadb5111484dd3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 26 May 2018 13:20:47 +0200 Subject: Separate headers into compilation units --- src/main.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/main.cc') diff --git a/src/main.cc b/src/main.cc index 9f32bc3..cd8668e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,9 +1,10 @@ -#include -#include - #include #include #include +#include + +#include +#include #include "glfw/guard.h" #include "glfw/window.h" @@ -23,7 +24,7 @@ #include "shader/code/display_vertex.glsl" #include "shader/code/display_fragment.glsl" -#include "util.h" +#include "timer.h" const unsigned int particle_count = 2500; const unsigned int max_ups = 100; @@ -86,7 +87,7 @@ int main() { Window window("computicle"); if ( !window.isGood() ) { - std::cerr << "Failed to open window." << std::endl; + std::cerr << "Failed to open GLFW window." << std::endl; return -1; } @@ -135,8 +136,8 @@ int main() { return -1; } - auto lastFrame = std::chrono::high_resolution_clock::now(); - auto lastRotate = std::chrono::high_resolution_clock::now(); + auto lastFrame = timer::now(); + auto lastRotate = timer::now(); bool justRotated = true; std::vector textures; @@ -158,21 +159,21 @@ int main() { } } - if ( util::millisecondsSince(lastFrame) >= 1000/max_ups ) { + if ( timer::millisecondsSince(lastFrame) >= 1000/max_ups ) { auto guard = compute_shader->use(); compute_shader->setUniform("world", world_width, world_height); compute_shader->dispatch(particle_count); - lastFrame = std::chrono::high_resolution_clock::now(); + lastFrame = timer::now(); } - if ( util::millisecondsSince(lastRotate) >= 1000/10 ) { + if ( timer::millisecondsSince(lastRotate) >= 1000/10 ) { std::rotate(textures.begin(), textures.end()-1, textures.end()); std::rotate(texture_framebuffers.begin(), texture_framebuffers.end()-1, texture_framebuffers.end()); justRotated = true; - lastRotate = std::chrono::high_resolution_clock::now(); + lastRotate = timer::now(); } { -- cgit v1.2.3