>>106498002
Here's the custom "output" functiont that renders a single frame and then terminates:
/// Output mode prints the initial location to the terminal and then exits.
fn start_output(settings: Settings) {
let mut stdout = stdout();
let mut term_size = (30, 30);
let mut canvas = if term_size.0 > term_size.1 {
Canvas::new(term_size.1 * 8, term_size.1 * 8, None)
} else {
Canvas::new(term_size.0 * 4, term_size.0 * 4, None)
};
let mut cam_zoom = settings.cam_zoom;
let mut cam_xy = 0.;
let mut cam_z = 0.;
// set the initial coordinates
focus_target(settings.coords, 0., &mut cam_xy, &mut cam_z);
let mut globe = GlobeConfig::new()
.use_template(GlobeTemplate::Earth)
.with_camera(CameraConfig::new(cam_zoom, cam_xy, cam_z))
.display_night(settings.night)
.build();
let globe_rot_speed = settings.globe_rotation_speed / 1000.;
let cam_rot_speed = settings.cam_rotation_speed / 1000.;
// apply globe rotation
globe.angle += globe_rot_speed;
cam_xy -= globe_rot_speed / 2.;
// apply camera rotation
cam_xy -= cam_rot_speed;
globe.camera.update(cam_zoom, cam_xy, cam_z);
// render globe on the canvas
canvas.clear();
globe.render_on(&mut canvas);
// print canvas to stdoutput
simple_print_canvas(&mut canvas, &term_size, &mut stdout);
}