X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=main.rs;h=3b07180313e4ce50ef1be991610dc4782157b761;hb=a8881527feaf60d0f01bc44d118fe094204fdc39;hp=8370992d633788911db26eecf2835ac4227fe474;hpb=6022e031acedd52a7a6493e1820daeaf82ea2780;p=mandelwow.git diff --git a/main.rs b/main.rs index 8370992..3b07180 100644 --- a/main.rs +++ b/main.rs @@ -6,7 +6,7 @@ use glium::{Display, Program, Surface, uniform}; use mandelwow_lib::*; use std::f32::consts::PI; use std::rc::Rc; -use std::time::{Duration, Instant}; +use instant::{Duration, Instant}; #[cfg(target_os = "emscripten")] use std::os::raw::{c_int, c_void}; @@ -72,6 +72,7 @@ impl World { 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 { @@ -85,11 +86,11 @@ impl World { 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, @@ -253,12 +254,9 @@ fn main() { let mut soundplayer = sound::start(); let event_loop = glutin::event_loop::EventLoop::new(); - //let fullscreen = Some(glutin::window::Fullscreen::Borderless(event_loop.primary_monitor())); let window = glutin::window::WindowBuilder::new() //.with_dimensions(1280, 720) - //.with_fullscreen(fullscreen); - ; - //.with_title("MandelWow"); + .with_title("MandelWow"); let context = glutin::ContextBuilder::new() //.with_gl_profile(glutin::GlProfile::Core) //.with_gl(glutin::GlRequest::Specific(glutin::Api::WebGl, (2, 0))) @@ -276,7 +274,7 @@ fn main() { let mut timer = Timer::new(); let mut camera = support::camera::CameraState::new(); - let _fullscreen = true; + let mut fullscreen = true; event_loop.run(move |event, _, control_flow| { let t = timer.t; @@ -313,19 +311,17 @@ fn main() { 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; - if fullscreen { - // Not implemented on Linux - glutin::WindowBuilder::new() - .with_fullscreen(glutin::get_primary_monitor()) - .with_depth_buffer(24) .rebuild_glium(&display).unwrap(); } - else { - glutin::WindowBuilder::new() - .rebuild_glium(&display).unwrap(); - }*/ + let fs = if fullscreen { + let monitor_handle = display.gl_window().window() + .available_monitors().next().unwrap(); + Some(glium::glutin::window::Fullscreen::Borderless(monitor_handle)) + } else { + None + }; + display.gl_window().window().set_fullscreen(fs); } _ => (), }