X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fmain.h;h=9929d69e333bb86b8a4444094c881f6a3ae536cf;hp=d20ea528b10b6397301b7d101fe3849dd51fa9da;hb=6ce000e7212d9f5db6e5998c41df15bcad2022c8;hpb=77137590512d969da2d54d9ba53d76836a290c6a diff --git a/src/main.h b/src/main.h index d20ea52..9929d69 100644 --- a/src/main.h +++ b/src/main.h @@ -79,7 +79,7 @@ void RatCatcher(int x, int y, int buttons, int wheel, Screen * scr, View * view) } -inline void MainLoop(Document & doc, Screen & scr, View & view) +inline void MainLoop(Document & doc, Screen & scr, View & view, int max_frames = -1) { // order is important... segfaults occur when screen (which inits GL) is not constructed first -_- @@ -98,7 +98,8 @@ inline void MainLoop(Document & doc, Screen & scr, View & view) double data_rate = 0; // period between data output to stdout (if <= 0 there will be no output) uint64_t data_points = 0; setbuf(stdout, NULL); - while (scr.PumpEvents()) + int frame_number = 0; + while (scr.PumpEvents() && (max_frames < 0 || frame_number++ < max_frames)) { real_clock_prev = real_clock_now; ++frames;