X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.cpp;h=0f1277535367ca060caffbcf018dd4a356630623;hb=f932e8c0273794bcd954c9f5b504bad6140f7cf4;hp=9580d33560024171ab9db84e957777b697f2c970;hpb=7caa2326d25d4fc5ba98318dfccb508bb3e16820;p=blank.git diff --git a/src/app.cpp b/src/app.cpp index 9580d33..0f12775 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -31,12 +31,6 @@ Application::Application() , place_id(1) { GLContext::EnableVSync(); - GLuint VertexArrayID; - glGenVertexArrays(1, &VertexArrayID); - glBindVertexArray(VertexArrayID); - - world.Generate({ -4, -4, -4 }, { 5, 5, 5}); - hud.Viewport(960, 600); hud.Display(*world.BlockTypes()[place_id]); @@ -44,6 +38,34 @@ Application::Application() } +void Application::RunN(size_t n) { + Uint32 last = SDL_GetTicks(); + for (size_t i = 0; i < n; ++i) { + Uint32 now = SDL_GetTicks(); + int delta = now - last; + Loop(delta); + last = now; + } +} + +void Application::RunT(size_t t) { + Uint32 last = SDL_GetTicks(); + Uint32 finish = last + t; + while (last < finish) { + Uint32 now = SDL_GetTicks(); + int delta = now - last; + Loop(delta); + last = now; + } +} + +void Application::RunS(size_t n, size_t t) { + for (size_t i = 0; i < n; ++i) { + Loop(t); + } +} + + void Application::Run() { running = true; Uint32 last = SDL_GetTicks();