Update dependencies: glutin 0.29, winit 0.27, and more (#700)

* Update to glutin 0.29.0, winit 0.27.0. Closes #695
Change true/false to CursorGrabMode::Locked/None for set_cursor_grab
https://github.com/rust-windowing/winit/releases/tag/v0.27.0
> Breaking: Window::set_cursor_grab now accepts CursorGrabMode to control grabbing behavior.

* Update web-sys to 0.3.59. Closes #699

* Update flate2 to 1.0.24. Closes #698

* Update zip to 0.6.2. Closes #697

* Update to log 0.4.17. Closes #696
This commit is contained in:
iceiix 2022-07-30 15:54:49 -07:00 committed by GitHub
parent e00e249793
commit ba3cf43f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 653 additions and 621 deletions

1234
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -30,19 +30,19 @@ opt-level = 1
[dependencies] [dependencies]
cfg-if = "1.0.0" cfg-if = "1.0.0"
wasm-bindgen = "0.2.81" wasm-bindgen = "0.2.81"
winit = { version = "0.25.0", features = [ "web-sys" ]} winit = "0.27.0"
glow = "0.11.2" glow = "0.11.2"
byteorder = "1.4.3" byteorder = "1.4.3"
serde = "1.0.140" serde = "1.0.140"
serde_json = "1.0.82" serde_json = "1.0.82"
flate2 = { version = "1.0.22", features = ["rust_backend"], default-features = false } flate2 = { version = "1.0.24", features = ["rust_backend"], default-features = false }
zip = { version = "0.5.13", features = ["deflate"], default-features = false } zip = { version = "0.6.2", features = ["deflate"], default-features = false }
image = "0.23.14" image = "0.23.14"
getrandom = { version = "0.2.7", features = ["js"] } getrandom = { version = "0.2.7", features = ["js"] }
rand = "0.8.5" rand = "0.8.5"
rand_pcg = "0.3.1" rand_pcg = "0.3.1"
base64 = "0.13.0" base64 = "0.13.0"
log = { version = "0.4.14", features = ["std"] } log = { version = "0.4.17", features = ["std"] }
cgmath = "0.17.0" cgmath = "0.17.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
collision = "0.20.1" collision = "0.20.1"
@ -55,11 +55,11 @@ dirs = "4.0.0"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
reqwest = { version = "0.11.11", features = [ "blocking" ]} reqwest = { version = "0.11.11", features = [ "blocking" ]}
glutin = "0.27.0" glutin = "0.29.0"
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
web-sys = "0.3.55" web-sys = "0.3.59"
[dependencies.steven_resources] [dependencies.steven_resources]
path = "./resources" path = "./resources"

View File

@ -12,8 +12,8 @@ sha-1 = "0.9.7"
aes = "0.7.4" aes = "0.7.4"
cfb8 = "0.7.1" cfb8 = "0.7.1"
byteorder = "1.4.3" byteorder = "1.4.3"
log = { version = "0.4.14", features = ["std"] } log = { version = "0.4.17", features = ["std"] }
flate2 = { version = "1.0.22", features = ["rust_backend"], default-features = false } flate2 = { version = "1.0.24", features = ["rust_backend"], default-features = false }
num-traits = "0.2.14" num-traits = "0.2.14"
instant = "0.1.12" instant = "0.1.12"

View File

@ -659,7 +659,9 @@ fn handle_window_event<T>(
use std::f64::consts::PI; use std::f64::consts::PI;
if game.focused { if game.focused {
window.set_cursor_grab(true).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false); window.set_cursor_visible(false);
if let Some(player) = game.server.player { if let Some(player) = game.server.player {
let rotation = game let rotation = game
@ -677,7 +679,9 @@ fn handle_window_event<T>(
} }
} }
} else { } else {
window.set_cursor_grab(false).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true); window.set_cursor_visible(true);
} }
} }
@ -715,12 +719,16 @@ fn handle_window_event<T>(
&& !game.screen_sys.is_current_closable() && !game.screen_sys.is_current_closable()
{ {
game.focused = true; game.focused = true;
window.set_cursor_grab(true).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false); window.set_cursor_visible(false);
} else if !game.focused { } else if !game.focused {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
// TODO: after Pointer Lock https://github.com/rust-windowing/winit/issues/1674 // TODO: after Pointer Lock https://github.com/rust-windowing/winit/issues/1674
window.set_cursor_grab(false).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true); window.set_cursor_visible(true);
ui_container.click_at( ui_container.click_at(
game, game,
@ -766,14 +774,18 @@ fn handle_window_event<T>(
match (input.state, input.virtual_keycode) { match (input.state, input.virtual_keycode) {
(ElementState::Released, Some(VirtualKeyCode::Escape)) => { (ElementState::Released, Some(VirtualKeyCode::Escape)) => {
if game.focused { if game.focused {
window.set_cursor_grab(false).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true); window.set_cursor_visible(true);
game.focused = false; game.focused = false;
game.screen_sys.replace_screen(Box::new( game.screen_sys.replace_screen(Box::new(
screen::SettingsMenu::new(game.vars.clone(), true), screen::SettingsMenu::new(game.vars.clone(), true),
)); ));
} else if game.screen_sys.is_current_closable() { } else if game.screen_sys.is_current_closable() {
window.set_cursor_grab(true).unwrap(); window
.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.unwrap();
window.set_cursor_visible(false); window.set_cursor_visible(false);
game.focused = true; game.focused = true;
game.screen_sys.pop_screen(); game.screen_sys.pop_screen();