WIP stabilize screenshotting

This commit is contained in:
Dustin Carlino 2019-02-05 15:14:59 -08:00
parent 72b39b0401
commit e1155a1d9c

View File

@ -1,7 +1,7 @@
use crate::runner::{State, GUI};
use abstutil::Timer;
use std::io::Write;
use std::{fs, process};
use std::{fs, process, thread, time};
pub(crate) fn screenshot_everything<T, G: GUI<T>>(
mut state: State<T, G>,
@ -30,6 +30,9 @@ pub(crate) fn screenshot_everything<T, G: GUI<T>>(
state.canvas.cam_y = (tile_y as f64) * state.canvas.window_height;
let naming_hint = state.draw(display, program, true, 0);
// TODO Is vsync or something else causing the above redraw to not actually show up in
// time for scrot to see it? This is slow (30s total for Montlake), but stable.
thread::sleep(time::Duration::from_millis(100));
if let Some(filename) = screencap(tile_x, tile_y, naming_hint) {
filenames.push(filename);
} else {