c7026710cc0a85e03bb67c7ca6985943516a1b0a
[mandelwow.git] / lib.rs
1 extern crate cgmath;
2 #[macro_use(uniform,program,implement_vertex)]
3 extern crate glium;
4 extern crate glutin;
5 extern crate image;
6 extern crate libxm;
7 extern crate sdl2;
8
9 pub mod bounding_box;
10 pub mod cube;
11 pub mod mandelwow;
12 pub mod shaded_cube;
13 pub mod sound;
14 pub mod support;
15 pub mod text;
16
17 pub use bounding_box::BoundingBox;
18 pub use cube::Cube;
19 pub use shaded_cube::ShadedCube;
20
21 pub fn screenshot(display : &glium::Display) {
22     let image: glium::texture::RawImage2d<u8> = display.read_front_buffer();
23     let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
24     let image = image::DynamicImage::ImageRgba8(image).flipv();
25     let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap();
26     image.save(&mut output, image::ImageFormat::PNG).unwrap();
27 }
28