Remove deprecatd emscripten option ERROR_ON_MISSING_LIBRARIES
[mandelwow.git] / lib.rs
1 pub mod bounding_box;
2 pub mod cube;
3 pub mod mandelwow;
4 pub mod shaded_cube;
5 pub mod sound;
6 pub mod support;
7 pub mod text;
8 pub mod timer;
9
10 pub use crate::bounding_box::BoundingBox;
11 pub use crate::cube::Cube;
12 pub use crate::shaded_cube::ShadedCube;
13 pub use crate::text::Text;
14 pub use crate::timer::Timer;
15
16 #[cfg(feature = "image")]
17 pub fn screenshot(display : &glium::Display) {
18     let image: glium::texture::RawImage2d<'_, u8> = display.read_front_buffer().unwrap();
19     let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
20     let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb();
21     let image = image::DynamicImage::ImageRgb8(image);
22     let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap();
23     image.write_to(&mut output, image::ImageFormat::PNG).unwrap();
24 }
25
26 #[cfg(not(feature = "image"))]
27 pub fn screenshot(_ : &glium::Display) {
28 }