mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Update to winit 0.21.0
This commit is contained in:
parent
d1b635efa4
commit
21a1382850
269
Cargo.lock
generated
269
Cargo.lock
generated
@ -482,6 +482,15 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cgl"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.11"
|
||||
@ -674,7 +683,7 @@ dependencies = [
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"smithay-clipboard",
|
||||
"wayland-client",
|
||||
"wayland-client 0.23.6",
|
||||
"x11-clipboard",
|
||||
]
|
||||
|
||||
@ -1044,17 +1053,6 @@ dependencies = [
|
||||
"byteorder 1.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3c6d883546668a3e2011b6a716a7330b82eabb0151b138217f632c8243e17135"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
version = "1.1.1"
|
||||
@ -1126,6 +1124,12 @@ version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605"
|
||||
|
||||
[[package]]
|
||||
name = "dispatch"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.4.2"
|
||||
@ -1571,11 +1575,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "gfx_window_glutin"
|
||||
version = "0.31.0"
|
||||
source = "git+https://github.com/Imberflur/gfx_window_glutin.git#6586513e6b22924e61d1106e426768ac4f1cb55d"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "310ff66f08b5a55854b18fea2f48bdbb75c94458207ba574c9723be78e97a646"
|
||||
dependencies = [
|
||||
"gfx_core",
|
||||
"gfx_device_gl",
|
||||
"glutin",
|
||||
"glutin 0.21.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1734,16 +1739,41 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glutin"
|
||||
version = "0.22.0-alpha3"
|
||||
version = "0.21.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcdd3592b515014281a21a42addd91f41eaff0c5f54295ee28dac8ea6bbbceba"
|
||||
checksum = "5371b35b309dace06be1b81b5f6adb1c9de578b7dbe1e74bf7e4ef762cf6febd"
|
||||
dependencies = [
|
||||
"android_glue",
|
||||
"cgl",
|
||||
"cgl 0.2.3",
|
||||
"cocoa 0.18.5",
|
||||
"core-foundation 0.6.4",
|
||||
"core-graphics 0.17.3",
|
||||
"derivative",
|
||||
"glutin_egl_sys",
|
||||
"glutin_emscripten_sys",
|
||||
"glutin_gles2_sys",
|
||||
"glutin_glx_sys",
|
||||
"glutin_wgl_sys",
|
||||
"lazy_static",
|
||||
"libloading 0.5.2",
|
||||
"objc",
|
||||
"osmesa-sys",
|
||||
"parking_lot 0.9.0",
|
||||
"wayland-client 0.21.13",
|
||||
"winapi 0.3.8",
|
||||
"winit 0.19.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glutin"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf22d4e90c55d9be9f2ad52410e7a2c0d7e9c99d93a13df73a672e7ef4e8c7f7"
|
||||
dependencies = [
|
||||
"android_glue",
|
||||
"cgl 0.3.2",
|
||||
"cocoa 0.19.1",
|
||||
"core-foundation 0.6.4",
|
||||
"core-graphics 0.17.3",
|
||||
"glutin_egl_sys",
|
||||
"glutin_emscripten_sys",
|
||||
"glutin_gles2_sys",
|
||||
@ -1754,10 +1784,10 @@ dependencies = [
|
||||
"log",
|
||||
"objc",
|
||||
"osmesa-sys",
|
||||
"parking_lot 0.8.0",
|
||||
"wayland-client",
|
||||
"parking_lot 0.10.2",
|
||||
"wayland-client 0.23.6",
|
||||
"winapi 0.3.8",
|
||||
"winit",
|
||||
"winit 0.21.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2307,15 +2337,6 @@ version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.3.4"
|
||||
@ -2755,6 +2776,16 @@ dependencies = [
|
||||
"byteorder 1.3.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "old_school_gfx_glutin_ext"
|
||||
version = "0.23.0"
|
||||
source = "git+https://github.com/Imberflur/old-school-gfx-glutin-ext.git#e128e187a81d1fa15409db38bc93e6677fc09288"
|
||||
dependencies = [
|
||||
"gfx_core",
|
||||
"gfx_device_gl",
|
||||
"glutin 0.23.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.4.0"
|
||||
@ -2850,24 +2881,13 @@ dependencies = [
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7"
|
||||
dependencies = [
|
||||
"lock_api 0.2.0",
|
||||
"parking_lot_core 0.5.0",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252"
|
||||
dependencies = [
|
||||
"lock_api 0.3.4",
|
||||
"lock_api",
|
||||
"parking_lot_core 0.6.2",
|
||||
"rustc_version",
|
||||
]
|
||||
@ -2878,26 +2898,10 @@ version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
|
||||
dependencies = [
|
||||
"lock_api 0.3.4",
|
||||
"lock_api",
|
||||
"parking_lot_core 0.7.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cloudabi",
|
||||
"libc",
|
||||
"rand 0.6.5",
|
||||
"redox_syscall",
|
||||
"rustc_version",
|
||||
"smallvec 0.6.13",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.6.2"
|
||||
@ -3771,6 +3775,23 @@ version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa"
|
||||
dependencies = [
|
||||
"andrew",
|
||||
"bitflags",
|
||||
"dlib",
|
||||
"lazy_static",
|
||||
"memmap",
|
||||
"nix 0.14.1",
|
||||
"wayland-client 0.21.13",
|
||||
"wayland-commons 0.21.13",
|
||||
"wayland-protocols 0.21.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.6.6"
|
||||
@ -3783,8 +3804,8 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"memmap",
|
||||
"nix 0.14.1",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-client 0.23.6",
|
||||
"wayland-protocols 0.23.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3794,7 +3815,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "917e8ec7f535cd1a6cbf749c8866c24d67c548a80ac48c8e88a182eab5c07bd1"
|
||||
dependencies = [
|
||||
"nix 0.14.1",
|
||||
"smithay-client-toolkit",
|
||||
"smithay-client-toolkit 0.6.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4589,7 +4610,7 @@ dependencies = [
|
||||
"crossbeam",
|
||||
"deunicode",
|
||||
"directories-next",
|
||||
"dispatch",
|
||||
"dispatch 0.1.4",
|
||||
"dot_vox",
|
||||
"euc",
|
||||
"failure",
|
||||
@ -4599,12 +4620,13 @@ dependencies = [
|
||||
"gilrs",
|
||||
"git2",
|
||||
"glsl-include",
|
||||
"glutin",
|
||||
"glutin 0.23.0",
|
||||
"guillotiere",
|
||||
"hashbrown",
|
||||
"image",
|
||||
"msgbox",
|
||||
"num 0.2.1",
|
||||
"old_school_gfx_glutin_ext",
|
||||
"rand 0.7.3",
|
||||
"rodio",
|
||||
"ron",
|
||||
@ -4624,7 +4646,7 @@ dependencies = [
|
||||
"veloren-server",
|
||||
"veloren-voxygen-anim",
|
||||
"veloren-world",
|
||||
"winit",
|
||||
"winit 0.21.0",
|
||||
"winres",
|
||||
]
|
||||
|
||||
@ -4789,6 +4811,21 @@ version = "0.2.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.21.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"downcast-rs",
|
||||
"libc",
|
||||
"nix 0.14.1",
|
||||
"wayland-commons 0.21.13",
|
||||
"wayland-scanner 0.21.13",
|
||||
"wayland-sys 0.21.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-client"
|
||||
version = "0.23.6"
|
||||
@ -4801,9 +4838,19 @@ dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"nix 0.14.1",
|
||||
"wayland-commons",
|
||||
"wayland-scanner",
|
||||
"wayland-sys",
|
||||
"wayland-commons 0.23.6",
|
||||
"wayland-scanner 0.23.6",
|
||||
"wayland-sys 0.23.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-commons"
|
||||
version = "0.21.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec"
|
||||
dependencies = [
|
||||
"nix 0.14.1",
|
||||
"wayland-sys 0.21.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4813,7 +4860,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb66b0d1a27c39bbce712b6372131c6e25149f03ffb0cd017cf8f7de8d66dbdb"
|
||||
dependencies = [
|
||||
"nix 0.14.1",
|
||||
"wayland-sys",
|
||||
"wayland-sys 0.23.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.21.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-client 0.21.13",
|
||||
"wayland-commons 0.21.13",
|
||||
"wayland-scanner 0.21.13",
|
||||
"wayland-sys 0.21.13",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4823,9 +4883,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6cc286643656742777d55dc8e70d144fa4699e426ca8e9d4ef454f4bf15ffcf9"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-client",
|
||||
"wayland-commons",
|
||||
"wayland-scanner",
|
||||
"wayland-client 0.23.6",
|
||||
"wayland-commons 0.23.6",
|
||||
"wayland-scanner 0.23.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.21.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf3828c568714507315ee425a9529edc4a4aa9901409e373e9e0027e7622b79e"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4839,6 +4910,16 @@ dependencies = [
|
||||
"xml-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-sys"
|
||||
version = "0.21.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628"
|
||||
dependencies = [
|
||||
"dlib",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-sys"
|
||||
version = "0.23.6"
|
||||
@ -4923,19 +5004,16 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.20.0-alpha4"
|
||||
version = "0.19.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56c565622ccb05351d92445415952ca09dade6a53e75dd9e75d9bd35d4e99333"
|
||||
checksum = "1e96eb4bb472fa43e718e8fa4aef82f86cd9deac9483a1e1529230babdb394a8"
|
||||
dependencies = [
|
||||
"android_glue",
|
||||
"backtrace",
|
||||
"bitflags",
|
||||
"calloop",
|
||||
"cocoa 0.19.1",
|
||||
"cocoa 0.18.5",
|
||||
"core-foundation 0.6.4",
|
||||
"core-graphics 0.17.3",
|
||||
"core-video-sys",
|
||||
"dispatch",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
@ -4943,9 +5021,38 @@ dependencies = [
|
||||
"parking_lot 0.9.0",
|
||||
"percent-encoding 2.1.0",
|
||||
"raw-window-handle",
|
||||
"smithay-client-toolkit 0.4.6",
|
||||
"wayland-client 0.21.13",
|
||||
"winapi 0.3.8",
|
||||
"x11-dl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winit"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65a5c1a5ef76ac31cc97ad29489acdbed2178f3fc12ca00ee6cb11d60adb5a3a"
|
||||
dependencies = [
|
||||
"android_glue",
|
||||
"bitflags",
|
||||
"cocoa 0.19.1",
|
||||
"core-foundation 0.6.4",
|
||||
"core-graphics 0.17.3",
|
||||
"core-video-sys",
|
||||
"dispatch 0.2.0",
|
||||
"instant",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"mio",
|
||||
"mio-extras",
|
||||
"objc",
|
||||
"parking_lot 0.10.2",
|
||||
"percent-encoding 2.1.0",
|
||||
"raw-window-handle",
|
||||
"serde",
|
||||
"smithay-client-toolkit",
|
||||
"wayland-client",
|
||||
"smithay-client-toolkit 0.6.6",
|
||||
"wayland-client 0.23.6",
|
||||
"winapi 0.3.8",
|
||||
"x11-dl",
|
||||
]
|
||||
|
@ -25,10 +25,9 @@ anim = { package = "veloren-voxygen-anim", path = "src/anim", default-features =
|
||||
# Graphics
|
||||
gfx = "0.18.2"
|
||||
gfx_device_gl = { version = "0.16.2", optional = true }
|
||||
gfx_window_glutin = {git = "https://github.com/Imberflur/gfx_window_glutin.git" }
|
||||
# TODO: change to non alpha
|
||||
glutin = "=0.22.0-alpha3"
|
||||
winit = { version = "=0.20.0-alpha4", features = ["serde"] }
|
||||
old_school_gfx_glutin_ext = { git = "https://github.com/Imberflur/old-school-gfx-glutin-ext.git" }
|
||||
glutin = "0.23.0"
|
||||
winit = { version = "0.21.0", features = ["serde"] }
|
||||
conrod_core = { git = "https://gitlab.com/veloren/conrod.git", branch = "hide_text" }
|
||||
conrod_winit = { git = "https://gitlab.com/veloren/conrod.git", branch = "hide_text" }
|
||||
euc = { git = "https://github.com/zesterer/euc.git" }
|
||||
@ -88,7 +87,7 @@ winres = "0.1"
|
||||
criterion = "0.3"
|
||||
git2 = "0.13"
|
||||
world = { package = "veloren-world", path = "../world" }
|
||||
#gfx_window_glutin = { version = "0.31.0", features = ["headless"] }
|
||||
gfx_window_glutin = { version = "0.31.0", features = ["headless"] }
|
||||
|
||||
[[bench]]
|
||||
name = "meshing_benchmark"
|
||||
|
@ -1,7 +1,5 @@
|
||||
mod client_init;
|
||||
mod ui;
|
||||
// TODO: make sure turning off singleplayer feature still works (also make sure
|
||||
// all singleplayer stuff is still hidden with it off)
|
||||
|
||||
use super::char_selection::CharSelectionState;
|
||||
#[cfg(feature = "singleplayer")]
|
||||
|
@ -17,13 +17,16 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
||||
});
|
||||
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
// Continously run loop since we handle sleeping
|
||||
*control_flow = winit::event_loop::ControlFlow::Poll;
|
||||
|
||||
// Get events for the ui.
|
||||
if let Some(event) = ui::Event::try_from(event.clone(), global_state.window.window()) {
|
||||
if let Some(event) = ui::Event::try_from(&event, global_state.window.window()) {
|
||||
global_state.window.send_event(Event::Ui(event));
|
||||
}
|
||||
|
||||
match event {
|
||||
winit::event::Event::EventsCleared => {
|
||||
winit::event::Event::MainEventsCleared => {
|
||||
// Run tick here
|
||||
|
||||
// What's going on here?
|
||||
@ -94,11 +97,9 @@ pub fn run(mut global_state: GlobalState, event_loop: EventLoop) {
|
||||
}
|
||||
}
|
||||
|
||||
*control_flow = if exit {
|
||||
winit::event_loop::ControlFlow::Exit
|
||||
} else {
|
||||
winit::event_loop::ControlFlow::Poll
|
||||
};
|
||||
if exit {
|
||||
*control_flow = winit::event_loop::ControlFlow::Exit;
|
||||
}
|
||||
|
||||
// TODO: move
|
||||
if let Some(last) = states.last_mut() {
|
||||
|
@ -5,7 +5,7 @@ use vek::*;
|
||||
pub struct Event(pub Input);
|
||||
impl Event {
|
||||
pub fn try_from(
|
||||
event: glutin::event::Event<()>,
|
||||
event: &winit::event::Event<()>,
|
||||
window: &glutin::ContextWrapper<glutin::PossiblyCurrent, winit::window::Window>,
|
||||
) -> Option<Self> {
|
||||
use conrod_winit::*;
|
||||
@ -17,10 +17,14 @@ impl Event {
|
||||
// compatible conversion functions.
|
||||
impl<'a> conrod_winit::WinitWindow for WindowRef<'a> {
|
||||
fn get_inner_size(&self) -> Option<(u32, u32)> {
|
||||
Some(winit::window::Window::inner_size(&self.0).into())
|
||||
Some(
|
||||
winit::window::Window::inner_size(&self.0)
|
||||
.to_logical::<u32>(self.hidpi_factor())
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
fn hidpi_factor(&self) -> f32 { winit::window::Window::hidpi_factor(&self.0) as _ }
|
||||
fn hidpi_factor(&self) -> f64 { winit::window::Window::scale_factor(&self.0) }
|
||||
}
|
||||
convert_event!(event, &WindowRef(window.window())).map(|input| Self(input))
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ use crate::{
|
||||
settings::{ControlSettings, Settings},
|
||||
ui, Error,
|
||||
};
|
||||
use crossbeam::channel;
|
||||
use gilrs::{EventType, Gilrs};
|
||||
use hashbrown::HashMap;
|
||||
|
||||
use crossbeam::channel;
|
||||
use old_school_gfx_glutin_ext::{ContextBuilderExt, WindowInitExt, WindowUpdateExt};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use tracing::{error, info, warn};
|
||||
@ -483,7 +483,7 @@ pub struct Window {
|
||||
focused: bool,
|
||||
gilrs: Option<Gilrs>,
|
||||
controller_settings: ControllerSettings,
|
||||
cursor_position: winit::dpi::LogicalPosition,
|
||||
cursor_position: winit::dpi::PhysicalPosition<f64>,
|
||||
mouse_emulation_vec: Vec2<f32>,
|
||||
// Currently used to send and receive screenshot result messages
|
||||
message_sender: channel::Sender<String>,
|
||||
@ -504,17 +504,14 @@ impl Window {
|
||||
))
|
||||
.with_maximized(true);
|
||||
|
||||
let ctx_builder = glutin::ContextBuilder::new()
|
||||
.with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2)))
|
||||
.with_vsync(false);
|
||||
|
||||
let (window, device, factory, win_color_view, win_depth_view) =
|
||||
gfx_window_glutin::init::<WinColorFmt, WinDepthFmt, _>(
|
||||
win_builder,
|
||||
ctx_builder,
|
||||
&event_loop,
|
||||
)
|
||||
.map_err(|err| Error::BackendError(Box::new(err)))?;
|
||||
glutin::ContextBuilder::new()
|
||||
.with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2)))
|
||||
.with_vsync(false)
|
||||
.with_gfx_color_depth::<WinColorFmt, WinDepthFmt>()
|
||||
.build_windowed(win_builder, &event_loop)
|
||||
.map_err(|err| Error::BackendError(Box::new(err)))?
|
||||
.init_gfx::<WinColorFmt, WinDepthFmt>();
|
||||
|
||||
let vendor = device.get_info().platform_name.vendor;
|
||||
let renderer = device.get_info().platform_name.renderer;
|
||||
@ -584,7 +581,7 @@ impl Window {
|
||||
focused: true,
|
||||
gilrs,
|
||||
controller_settings,
|
||||
cursor_position: winit::dpi::LogicalPosition::new(0.0, 0.0),
|
||||
cursor_position: winit::dpi::PhysicalPosition::new(0.0, 0.0),
|
||||
mouse_emulation_vec: Vec2::zero(),
|
||||
// Currently used to send and receive screenshot result messages
|
||||
message_sender,
|
||||
@ -777,11 +774,11 @@ impl Window {
|
||||
}
|
||||
}
|
||||
|
||||
let mut events = std::mem::replace(&mut self.events, Vec::new());
|
||||
// Mouse emulation for the menus, to be removed when a proper menu navigation
|
||||
// system is available
|
||||
if !self.cursor_grabbed {
|
||||
self.events = self
|
||||
.events
|
||||
events = events
|
||||
.into_iter()
|
||||
.filter_map(|event| match event {
|
||||
Event::AnalogMenuInput(input) => match input {
|
||||
@ -794,36 +791,31 @@ impl Window {
|
||||
self.mouse_emulation_vec.y = d * -1.0;
|
||||
None
|
||||
},
|
||||
_ => {
|
||||
let event = Event::AnalogMenuInput(input);
|
||||
Some(event)
|
||||
},
|
||||
},
|
||||
Event::MenuInput(input, state) => match input {
|
||||
MenuInput::Apply => Some(match state {
|
||||
true => Event::Ui(ui::Event(conrod_core::event::Input::Press(
|
||||
conrod_core::input::Button::Mouse(
|
||||
conrod_core::input::state::mouse::Button::Left,
|
||||
),
|
||||
))),
|
||||
false => Event::Ui(ui::Event(conrod_core::event::Input::Release(
|
||||
conrod_core::input::Button::Mouse(
|
||||
conrod_core::input::state::mouse::Button::Left,
|
||||
),
|
||||
))),
|
||||
}),
|
||||
_ => Some(event),
|
||||
input => Some(Event::AnalogMenuInput(input)),
|
||||
},
|
||||
Event::MenuInput(MenuInput::Apply, state) => Some(match state {
|
||||
true => Event::Ui(ui::Event(conrod_core::event::Input::Press(
|
||||
conrod_core::input::Button::Mouse(
|
||||
conrod_core::input::state::mouse::Button::Left,
|
||||
),
|
||||
))),
|
||||
false => Event::Ui(ui::Event(conrod_core::event::Input::Release(
|
||||
conrod_core::input::Button::Mouse(
|
||||
conrod_core::input::state::mouse::Button::Left,
|
||||
),
|
||||
))),
|
||||
}),
|
||||
_ => Some(event),
|
||||
})
|
||||
.collect();
|
||||
|
||||
let sensitivity = self.controller_settings.mouse_emulation_sensitivity;
|
||||
// TODO: make this independent of framerate
|
||||
// TODO: consider multiplying by scale factor
|
||||
self.offset_cursor(self.mouse_emulation_vec * sensitivity as f32);
|
||||
}
|
||||
|
||||
std::mem::replace(&mut self.events, Vec::new())
|
||||
events
|
||||
}
|
||||
|
||||
pub fn handle_device_event(&mut self, event: winit::event::DeviceEvent) {
|
||||
@ -890,10 +882,12 @@ impl Window {
|
||||
|
||||
match event {
|
||||
WindowEvent::CloseRequested => self.events.push(Event::Close),
|
||||
WindowEvent::Resized(winit::dpi::LogicalSize { width, height }) => {
|
||||
WindowEvent::Resized(winit::dpi::PhysicalSize { width, height }) => {
|
||||
let (mut color_view, mut depth_view) = self.renderer.win_views_mut();
|
||||
gfx_window_glutin::update_views(&self.window, &mut color_view, &mut depth_view);
|
||||
self.window.update_gfx(&mut color_view, &mut depth_view);
|
||||
self.renderer.on_resize().unwrap();
|
||||
// TODO: update users of this event with the fact that it is now the physical
|
||||
// size
|
||||
self.events
|
||||
.push(Event::Resize(Vec2::new(width as u32, height as u32)));
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user