winit: upgrade to 0.23.0 / move back upstream! (#617)

This commit is contained in:
Carter Anderson 2020-10-02 12:24:30 -07:00 committed by GitHub
parent 4c753e2588
commit 22a2c88a47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 50 additions and 28 deletions

View file

@ -88,11 +88,11 @@ rand = "0.7.3"
serde = { version = "1", features = ["derive"] }
log = "0.4"
ron = "0.6"
anyhow = "1.0"
#wasm
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
console_error_panic_hook = "0.1.6"
console_log = { version = "0.2", features = ["color"] }
anyhow = "1.0"
[[example]]
name = "hello_world"

View file

@ -181,9 +181,11 @@ pub enum KeyCode {
AbntC1,
AbntC2,
Add,
NumpadAdd,
Apostrophe,
Apps,
Asterix,
Plus,
At,
Ax,
Backslash,
@ -192,8 +194,8 @@ pub enum KeyCode {
Colon,
Comma,
Convert,
Decimal,
Divide,
NumpadDecimal,
NumpadDivide,
Equals,
Grave,
Kana,
@ -207,7 +209,7 @@ pub enum KeyCode {
MediaSelect,
MediaStop,
Minus,
Multiply,
NumpadMultiply,
Mute,
MyComputer,
NavigateForward, // also called "Prior"
@ -231,7 +233,7 @@ pub enum KeyCode {
Slash,
Sleep,
Stop,
Subtract,
NumpadSubtract,
Sysrq,
Tab,
Underline,

View file

@ -26,10 +26,10 @@ bevy_window = { path = "../bevy_window", version = "0.2.1" }
bevy_utils = { path = "../bevy_utils", version = "0.2.1" }
# other
winit = { version = "0.22.2", package = "cart-tmp-winit", default-features = false }
winit = { version = "0.23.0", default-features = false }
log = { version = "0.4", features = ["release_max_level_info"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
winit = { version = "0.22.2", package = "cart-tmp-winit", features = ["web-sys"] }
winit = { version = "0.23.0", features = ["web-sys"], default-features = false }
wasm-bindgen = { version = "0.2" }
web-sys = "0.3"

View file

@ -121,9 +121,11 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::Numpad9 => KeyCode::Numpad9,
winit::event::VirtualKeyCode::AbntC1 => KeyCode::AbntC1,
winit::event::VirtualKeyCode::AbntC2 => KeyCode::AbntC2,
winit::event::VirtualKeyCode::Add => KeyCode::Add,
winit::event::VirtualKeyCode::NumpadAdd => KeyCode::NumpadAdd,
winit::event::VirtualKeyCode::Apostrophe => KeyCode::Apostrophe,
winit::event::VirtualKeyCode::Apps => KeyCode::Apps,
winit::event::VirtualKeyCode::Asterisk => KeyCode::Asterix,
winit::event::VirtualKeyCode::Plus => KeyCode::Plus,
winit::event::VirtualKeyCode::At => KeyCode::At,
winit::event::VirtualKeyCode::Ax => KeyCode::Ax,
winit::event::VirtualKeyCode::Backslash => KeyCode::Backslash,
@ -132,8 +134,8 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::Colon => KeyCode::Colon,
winit::event::VirtualKeyCode::Comma => KeyCode::Comma,
winit::event::VirtualKeyCode::Convert => KeyCode::Convert,
winit::event::VirtualKeyCode::Decimal => KeyCode::Decimal,
winit::event::VirtualKeyCode::Divide => KeyCode::Divide,
winit::event::VirtualKeyCode::NumpadDecimal => KeyCode::NumpadDecimal,
winit::event::VirtualKeyCode::NumpadDivide => KeyCode::NumpadDivide,
winit::event::VirtualKeyCode::Equals => KeyCode::Equals,
winit::event::VirtualKeyCode::Grave => KeyCode::Grave,
winit::event::VirtualKeyCode::Kana => KeyCode::Kana,
@ -147,7 +149,7 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::MediaSelect => KeyCode::MediaSelect,
winit::event::VirtualKeyCode::MediaStop => KeyCode::MediaStop,
winit::event::VirtualKeyCode::Minus => KeyCode::Minus,
winit::event::VirtualKeyCode::Multiply => KeyCode::Multiply,
winit::event::VirtualKeyCode::NumpadMultiply => KeyCode::NumpadMultiply,
winit::event::VirtualKeyCode::Mute => KeyCode::Mute,
winit::event::VirtualKeyCode::MyComputer => KeyCode::MyComputer,
winit::event::VirtualKeyCode::NavigateForward => KeyCode::NavigateForward,
@ -171,7 +173,7 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode)
winit::event::VirtualKeyCode::Slash => KeyCode::Slash,
winit::event::VirtualKeyCode::Sleep => KeyCode::Sleep,
winit::event::VirtualKeyCode::Stop => KeyCode::Stop,
winit::event::VirtualKeyCode::Subtract => KeyCode::Subtract,
winit::event::VirtualKeyCode::NumpadSubtract => KeyCode::NumpadSubtract,
winit::event::VirtualKeyCode::Sysrq => KeyCode::Sysrq,
winit::event::VirtualKeyCode::Tab => KeyCode::Tab,
winit::event::VirtualKeyCode::Underline => KeyCode::Underline,

View file

@ -29,8 +29,8 @@ impl WinitWindows {
)),
WindowMode::Fullscreen { use_size } => winit_window_builder.with_fullscreen(Some(
winit::window::Fullscreen::Exclusive(match use_size {
true => get_fitting_videomode(&event_loop.primary_monitor(), &window),
false => get_best_videomode(&event_loop.primary_monitor()),
true => get_fitting_videomode(&event_loop.primary_monitor().unwrap(), &window),
false => get_best_videomode(&event_loop.primary_monitor().unwrap()),
}),
)),
_ => winit_window_builder

View file

@ -1,10 +1,15 @@
#[cfg(target_arch = "wasm32")]
extern crate console_error_panic_hook;
use bevy::{asset::AssetLoader, prelude::*};
use std::{panic, path::PathBuf};
use std::path::PathBuf;
fn main() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
#[cfg(target_arch = "wasm32")]
{
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
}
App::build()
.add_default_plugins()

View file

@ -1,10 +1,15 @@
#[cfg(target_arch = "wasm32")]
extern crate console_error_panic_hook;
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
use std::{panic, time::Duration};
use std::time::Duration;
fn main() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
#[cfg(target_arch = "wasm32")]
{
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
}
App::build()
.add_plugin(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(

View file

@ -1,10 +1,14 @@
#[cfg(target_arch = "wasm32")]
extern crate console_error_panic_hook;
use bevy::prelude::*;
use std::panic;
fn main() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
#[cfg(target_arch = "wasm32")]
{
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
}
App::build().add_system(hello_wasm_system.system()).run();
}

View file

@ -1,4 +1,6 @@
#[cfg(target_arch = "wasm32")]
extern crate console_error_panic_hook;
use bevy::{
input::{
keyboard::KeyboardInput,
@ -6,11 +8,13 @@ use bevy::{
},
prelude::*,
};
use std::panic;
fn main() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
#[cfg(target_arch = "wasm32")]
{
std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_log::init_with_level(log::Level::Debug).expect("cannot initialize console_log");
}
App::build()
.add_resource(WindowDescriptor {