]> git.localhorst.tv Git - blank.git/blobdiff - src/app.cpp
split chunk loader from world
[blank.git] / src / app.cpp
index d8f1e2147ba2589df979be0c7bbdd3402fc4eb57..0f1277535367ca060caffbcf018dd4a356630623 100644 (file)
@@ -31,8 +31,6 @@ Application::Application()
 , place_id(1) {
        GLContext::EnableVSync();
 
-       world.Generate({ -4, -4, -4 }, { 5, 5, 5});
-
        hud.Viewport(960, 600);
        hud.Display(*world.BlockTypes()[place_id]);
 
@@ -40,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();