pub mod cube;
pub mod mandelwow;
pub mod shaded_cube;
+pub mod screenshot;
pub mod sound;
pub mod support;
pub mod text;
pub use crate::shaded_cube::ShadedCube;
pub use crate::text::Text;
pub use crate::timer::Timer;
-
-#[cfg(feature = "image")]
-pub fn screenshot(display : &glium::Display) {
- let image: glium::texture::RawImage2d<'_, u8> = display.read_front_buffer().unwrap();
- let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
- let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb();
- let image = image::DynamicImage::ImageRgb8(image);
- let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap();
- image.write_to(&mut output, image::ImageFormat::PNG).unwrap();
-}
-
-#[cfg(not(feature = "image"))]
-pub fn screenshot(_ : &glium::Display) {
-}
println!("xstep={} ystep={:?}", sea_xstep, sea_zstep);
let mut sea = [[Vector3::zero(); SEA_ZSIZE]; SEA_XSIZE];
+ #[allow(clippy::needless_range_loop)]
for x in 0..SEA_XSIZE {
for z in 0..SEA_ZSIZE {
sea[x][z] = Vector3 {
World {
mandelwow_program,
mandelwow_bbox: BoundingBox::new(
- display, &mandelwow_bounds, bounding_box_program.clone()),
+ display, &mandelwow_bounds, bounding_box_program),
mandelwow_bounds,
bounding_box_enabled: true,
- shaded_cube: ShadedCube::new(display, shaded_program.clone()),
+ shaded_cube: ShadedCube::new(display, shaded_program),
text: text::Text::new(display),
sea,
VirtualKeyCode::P => timer.pause ^= true,
VirtualKeyCode::PageUp => timer.t += 0.1,
VirtualKeyCode::PageDown => timer.t -= 0.2,
- VirtualKeyCode::F10 => screenshot(&display),
+ VirtualKeyCode::F10 => screenshot::take_screenshot(&display),
VirtualKeyCode::F11 | VirtualKeyCode::Return => {
fullscreen ^= true;
let fs = if fullscreen {
--- /dev/null
+#[cfg(feature = "image")]
+pub fn take_screenshot(display : &glium::Display) {
+ let image: glium::texture::RawImage2d<'_, u8> = display.read_front_buffer().unwrap();
+ let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap();
+ let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb();
+ let image = image::DynamicImage::ImageRgb8(image);
+ let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap();
+ image.write_to(&mut output, image::ImageFormat::PNG).unwrap();
+}
+
+#[cfg(not(feature = "image"))]
+pub fn take_screenshot(_ : &glium::Display) {
+}