Update to latest glium
This commit is contained in:
parent
14c2caf653
commit
c5548b1d28
|
@ -5,7 +5,7 @@ authors = ["Thomas Forgione <thomas@tforgione.fr>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
num = "0.1.42"
|
num = "0.1.42"
|
||||||
glium = "0.21.0"
|
glium = "0.22.0"
|
||||||
image = "0.19.0"
|
image = "0.19.0"
|
||||||
byteorder = "1.2.3"
|
byteorder = "1.2.3"
|
||||||
clap = "2.31.2"
|
clap = "2.31.2"
|
||||||
|
|
|
@ -12,6 +12,10 @@ use glium::glutin::{
|
||||||
VirtualKeyCode,
|
VirtualKeyCode,
|
||||||
MouseCursor,
|
MouseCursor,
|
||||||
};
|
};
|
||||||
|
use glium::glutin::dpi::{
|
||||||
|
LogicalSize,
|
||||||
|
LogicalPosition,
|
||||||
|
};
|
||||||
|
|
||||||
use math::vector::{Vector2, Vector3};
|
use math::vector::{Vector2, Vector3};
|
||||||
use camera::Camera;
|
use camera::Camera;
|
||||||
|
@ -107,7 +111,7 @@ impl Controls for OrbitControls {
|
||||||
},
|
},
|
||||||
|
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::Resized(width, height), ..
|
event: WindowEvent::Resized(LogicalSize { width, height }), ..
|
||||||
} => {
|
} => {
|
||||||
camera.aspect_ratio = width as f64 / height as f64;
|
camera.aspect_ratio = width as f64 / height as f64;
|
||||||
},
|
},
|
||||||
|
@ -129,7 +133,7 @@ impl Controls for OrbitControls {
|
||||||
|
|
||||||
Event::WindowEvent{
|
Event::WindowEvent{
|
||||||
event: WindowEvent::CursorMoved {
|
event: WindowEvent::CursorMoved {
|
||||||
position: (x, y), ..
|
position: LogicalPosition { x, y }, ..
|
||||||
}, ..
|
}, ..
|
||||||
} => {
|
} => {
|
||||||
let current_position = Vector2::new(x as f64, y as f64);
|
let current_position = Vector2::new(x as f64, y as f64);
|
||||||
|
@ -239,7 +243,7 @@ impl Controls for FirstPersonControls {
|
||||||
|
|
||||||
// On resize window
|
// On resize window
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::Resized(width, height), ..
|
event: WindowEvent::Resized(LogicalSize { width, height } ), ..
|
||||||
} => {
|
} => {
|
||||||
camera.aspect_ratio = width as f64 / height as f64;
|
camera.aspect_ratio = width as f64 / height as f64;
|
||||||
},
|
},
|
||||||
|
@ -302,12 +306,12 @@ impl Controls for FirstPersonControls {
|
||||||
// On mouse move
|
// On mouse move
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::CursorMoved {
|
event: WindowEvent::CursorMoved {
|
||||||
position: (x, y), ..
|
position: LogicalPosition { x, y }, ..
|
||||||
}, ..
|
}, ..
|
||||||
} => {
|
} => {
|
||||||
|
|
||||||
let size = renderer.gl_window().window().get_inner_size().unwrap();
|
let size = renderer.gl_window().window().get_inner_size().unwrap();
|
||||||
let center = Vector2::new(size.0 as f64 / 2.0, size.1 as f64 / 2.0);
|
let center = Vector2::new(size.width as f64 / 2.0, size.height as f64 / 2.0);
|
||||||
let current_position = Vector2::new(x as f64, y as f64);
|
let current_position = Vector2::new(x as f64, y as f64);
|
||||||
let difference = (current_position - center) / self.sensitivity;
|
let difference = (current_position - center) / self.sensitivity;
|
||||||
|
|
||||||
|
@ -330,7 +334,8 @@ impl Controls for FirstPersonControls {
|
||||||
renderer
|
renderer
|
||||||
.gl_window()
|
.gl_window()
|
||||||
.window()
|
.window()
|
||||||
.set_cursor_position(size.0 as i32 / 2, size.1 as i32/ 2)
|
.set_cursor_position(LogicalPosition::new(
|
||||||
|
size.width / 2.0, size.height / 2.0))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -345,7 +350,7 @@ impl Controls for FirstPersonControls {
|
||||||
|
|
||||||
fn update(&mut self, camera: &mut Camera, renderer: &Renderer) {
|
fn update(&mut self, camera: &mut Camera, renderer: &Renderer) {
|
||||||
|
|
||||||
renderer.gl_window().window().set_cursor(MouseCursor::NoneCursor);
|
// renderer.gl_window().window().set_cursor(MouseCursor::NoneCursor);
|
||||||
|
|
||||||
let mut speed = Vector3::new(0.0, 0.0, 0.0);
|
let mut speed = Vector3::new(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ fn main() {
|
||||||
match ev {
|
match ev {
|
||||||
// Close window
|
// Close window
|
||||||
Event::WindowEvent {
|
Event::WindowEvent {
|
||||||
event: WindowEvent::Closed, ..
|
event: WindowEvent::CloseRequested, ..
|
||||||
} => closed = true,
|
} => closed = true,
|
||||||
|
|
||||||
// Escape key
|
// Escape key
|
||||||
|
|
Loading…
Reference in New Issue