X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=main.rs;h=0cf1c18fce7db7f1a671c833373152252e9af75a;hb=1124a995ef96469daf8593cb7fe9a17ee11bac2e;hp=9d2563c2f599b0a47db1f0d6f487fa887f557e78;hpb=d9f3675b3a8ce0545b2413691c81adef3fa786ce;p=mandelwow.git diff --git a/main.rs b/main.rs index 9d2563c..0cf1c18 100644 --- a/main.rs +++ b/main.rs @@ -1,12 +1,12 @@ 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 instant::{Duration, Instant}; #[cfg(target_os = "emscripten")] use std::os::raw::{c_int, c_void}; @@ -286,12 +286,16 @@ fn main() { 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 }, _ => {} } @@ -333,7 +337,5 @@ fn main() { }, _ => (), } - - timer.update(); }); }