X-Git-Url: https://codewiz.org/gitweb?p=mandelwow.git;a=blobdiff_plain;f=support%2Fcamera.rs;h=25b1e7292b9fb54b92c0bcdb775e052e9f437074;hp=69e3bb5388447df98326398edabd3d01f13833e0;hb=HEAD;hpb=a8aebfadf8f18928b3f8ced81a7f0d4a4421466d diff --git a/support/camera.rs b/support/camera.rs index 69e3bb5..25b1e72 100644 --- a/support/camera.rs +++ b/support/camera.rs @@ -1,13 +1,11 @@ -extern crate glutin; - use cgmath::{Matrix4, Vector4}; use cgmath::conv::array4x4; -use glutin::WindowEvent::{KeyboardInput, MouseMoved}; -use glutin::VirtualKeyCode; +use glium; +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 { @@ -165,10 +163,11 @@ impl CameraState { //println!("camera_dir = {:?}", self.dir); } - pub fn process_input(&mut self, event: &glutin::WindowEvent) { + pub fn process_input(&mut self, event: &WindowEvent) { + //println!("camera event={:?}", event); match event { - &MouseMoved { position: (x, y), .. } => { - let (x, y) = (x as i32, y as i32); + WindowEvent::CursorMoved { position, .. } => { + let (x, y) = (position.x as i32, position.y as i32); if self.mouse_x == -1 { // Set initial absolute position. self.mouse_x = x; @@ -179,8 +178,8 @@ impl CameraState { self.mouse_x = x; self.mouse_y = y; } - &KeyboardInput { input, .. } => { - let pressed = input.state == glutin::ElementState::Pressed; + WindowEvent::KeyboardInput { input, .. } => { + let pressed = input.state == ElementState::Pressed; let key = match input.virtual_keycode { Some(key) => key, None => return,