use cgmath::conv::array4x4;
use cgmath::{Euler, Matrix4, Rad, SquareMatrix, Vector3, Vector4, Zero};
use glium::glutin::event::{ self, Event, VirtualKeyCode, WindowEvent };
-use glium::glutin::event_loop::{ ControlFlow };
+use glium::glutin::event_loop::ControlFlow;
use glium::{Display, Program, Surface, uniform};
+use instant::Duration;
use mandelwow_lib::*;
use std::f32::consts::PI;
use std::rc::Rc;
-use std::time::{Duration, Instant};
#[cfg(target_os = "emscripten")]
use std::os::raw::{c_int, c_void};
emscripten_GetProcAddress(addr.into_raw() as *const _) as *const _
});
gl.glGetInternalformativ(0, 0, 0, 0, 0);
-*/
+ */
let mut soundplayer = sound::start();
let mut timer = Timer::new();
let mut camera = support::camera::CameraState::new();
- let mut fullscreen = true;
+ let mut fullscreen = false;
event_loop.run(move |event, _, control_flow| {
let t = timer.t;
camera.update();
- *control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::from_nanos(16_666_667));
+ *control_flow = ControlFlow::WaitUntil(timer.now + Duration::from_nanos(16_666_667));
match event {
+ Event::MainEventsCleared => {
+ timer.update();
+ world.draw_frame(&display, &camera, t);
+ }
Event::NewEvents(cause) => {
match cause {
event::StartCause::ResumeTimeReached { .. } | event::StartCause::Init => {
- world.draw_frame(&display, &camera, t);
+ // FIXME
},
_ => {}
}
VirtualKeyCode::F11 | VirtualKeyCode::Return => {
fullscreen ^= true;
let fs = if fullscreen {
- let monitor_handle = display.gl_window().window()
- .available_monitors().next().unwrap();
- Some(glium::glutin::window::Fullscreen::Borderless(monitor_handle))
+ // let monitor_handle = display.gl_window().window()
+ // .available_monitors().next().unwrap();
+ Some(glium::glutin::window::Fullscreen::Borderless(None))
} else {
None
};
},
_ => (),
}
-
- timer.update();
});
}