X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=support%2Fcamera.rs;h=db6c55ac6b103723999c7efd959ed1650cd91ce3;hb=db8dabba713ca281b3c8c49642eccf5a6f0af250;hp=8460197f5558dac493376e11d5c4e855faa55665;hpb=6ef74275da11e766c2cbe53b676df6188203cae3;p=mandelwow.git diff --git a/support/camera.rs b/support/camera.rs index 8460197..db6c55a 100644 --- a/support/camera.rs +++ b/support/camera.rs @@ -1,11 +1,11 @@ use cgmath::{Matrix4, Vector4}; use cgmath::conv::array4x4; use glium; -use glium::glutin::VirtualKeyCode; +use glium::glutin::event::{ ElementState, VirtualKeyCode, WindowEvent }; use std::f32; use std::f32::consts::PI; -use support::vec3::Vec3; -use support::vec3::norm; +use crate::support::vec3::Vec3; +use crate::support::vec3::norm; #[derive(Default)] pub struct CameraState { @@ -163,9 +163,10 @@ impl CameraState { //println!("camera_dir = {:?}", self.dir); } - pub fn process_input(&mut self, event: &glium::glutin::WindowEvent) { + pub fn process_input(&mut self, event: &WindowEvent) { + //println!("camera event={:?}", event); match event { - &glium::glutin::WindowEvent::CursorMoved { position, .. } => { + &WindowEvent::CursorMoved { position, .. } => { let (x, y) = (position.x as i32, position.y as i32); if self.mouse_x == -1 { // Set initial absolute position. @@ -177,8 +178,8 @@ impl CameraState { self.mouse_x = x; self.mouse_y = y; } - &glium::glutin::WindowEvent::KeyboardInput { input, .. } => { - let pressed = input.state == glium::glutin::ElementState::Pressed; + &WindowEvent::KeyboardInput { input, .. } => { + let pressed = input.state == ElementState::Pressed; let key = match input.virtual_keycode { Some(key) => key, None => return,