mirror of
https://github.com/lightsoutgames/bevy_full_throttle
synced 2024-12-21 13:05:56 +00:00
chore: Upgrade Bevy to v0.13 and windows to v0.54.
This commit is contained in:
parent
1e938d4222
commit
5a7b155a8c
|
@ -9,11 +9,11 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = { version = "0.12", default-features = false }
|
bevy = { version = "0.13", default-features = false }
|
||||||
ctrlc = "3"
|
ctrlc = "3"
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
windows = { version = "0.52", features = [
|
windows = { version = "0.54", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_System_Power",
|
"Win32_System_Power",
|
||||||
"Win32_System_Registry",
|
"Win32_System_Registry",
|
||||||
|
|
|
@ -18,12 +18,15 @@ fn setup(mut commands: Commands) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut active: *mut GUID = std::ptr::null_mut();
|
let mut active: *mut GUID = std::ptr::null_mut();
|
||||||
Power::PowerGetActiveScheme(None, &mut active).expect("Failed to get active power scheme");
|
Power::PowerGetActiveScheme(None, &mut active)
|
||||||
|
.ok()
|
||||||
|
.expect("Failed to get active power scheme");
|
||||||
if let Some(active) = active.as_ref() {
|
if let Some(active) = active.as_ref() {
|
||||||
let scheme = DefaultScheme(*active);
|
let scheme = DefaultScheme(*active);
|
||||||
commands.insert_resource(scheme);
|
commands.insert_resource(scheme);
|
||||||
ctrlc::set_handler(move || {
|
ctrlc::set_handler(move || {
|
||||||
Power::PowerSetActiveScheme(None, Some(active))
|
Power::PowerSetActiveScheme(None, Some(active))
|
||||||
|
.ok()
|
||||||
.expect("Failed to set power scheme");
|
.expect("Failed to set power scheme");
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
})
|
})
|
||||||
|
@ -45,6 +48,7 @@ fn focus_change(
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
Power::PowerSetActiveScheme(None, Some(&GUID_MIN_POWER_SAVINGS))
|
Power::PowerSetActiveScheme(None, Some(&GUID_MIN_POWER_SAVINGS))
|
||||||
|
.ok()
|
||||||
.expect("Failed to set power scheme");
|
.expect("Failed to set power scheme");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,6 +56,7 @@ fn focus_change(
|
||||||
if config.restore_original_scheme_on_unfocus {
|
if config.restore_original_scheme_on_unfocus {
|
||||||
unsafe {
|
unsafe {
|
||||||
Power::PowerSetActiveScheme(None, Some(&**scheme))
|
Power::PowerSetActiveScheme(None, Some(&**scheme))
|
||||||
|
.ok()
|
||||||
.expect("Failed to set power scheme");
|
.expect("Failed to set power scheme");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,6 +70,7 @@ fn exit(mut exit: EventReader<AppExit>, scheme: Res<DefaultScheme>) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
unsafe {
|
unsafe {
|
||||||
Power::PowerSetActiveScheme(None, Some(&**scheme))
|
Power::PowerSetActiveScheme(None, Some(&**scheme))
|
||||||
|
.ok()
|
||||||
.expect("Failed to restore original power scheme");
|
.expect("Failed to restore original power scheme");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user