X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.cpp;fp=src%2Fapp.cpp;h=7ddbbf189180d43dccd577a91e68a057ef1c8f0f;hb=f01ebd81ff047eb3209e25e183564f72f587915f;hp=d8f1e2147ba2589df979be0c7bbdd3402fc4eb57;hpb=d66d14f853f2d05f54076d38c72e53419dfc4cc5;p=blank.git diff --git a/src/app.cpp b/src/app.cpp index d8f1e21..7ddbbf1 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -40,6 +40,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();