Compare commits

..

No commits in common. "main" and "v0.7.1" have entirely different histories.
main ... v0.7.1

3 changed files with 14 additions and 20 deletions

View File

@ -2,24 +2,6 @@
All notable changes to this project will be documented in this file.
## Version 0.7.4 - 2025-01-03
### Bug Fixes
- No need for *any* ctrl-c handling since Bevy already does the right thing.
## Version 0.7.3 - 2025-01-03
### Bug Fixes
- Don't explicitly add ctrl-c-handling plugin as it is likely included in related groups.
## Version 0.7.2 - 2025-01-03
### Bug Fixes
- Actually integrate Bevy 0.15's handling for `ctrlc`.
## Version 0.7.1 - 2024-12-05
### Miscellaneous Tasks

View File

@ -3,7 +3,7 @@ name = "bevy_full_throttle"
description = "Enable CPU performance mode for Bevy games"
license = "MIT OR Apache-2.0"
repository = "https://labs.lightsout.games/projects/bevy_full_throttle"
version = "0.7.4"
version = "0.7.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -12,6 +12,7 @@ edition = "2021"
bevy = { version = "0.15", default-features = false, features = [
"bevy_window",
] }
ctrlc = "3"
[target.'cfg(windows)'.dependencies]
windows = { version = "0.58", features = [

View File

@ -1,5 +1,9 @@
#[allow(unused_imports)]
use bevy::{app::AppExit, prelude::*, window::WindowFocused};
use bevy::{
app::{AppExit, TerminalCtrlCHandlerPlugin},
prelude::*,
window::WindowFocused,
};
#[cfg(windows)]
use windows::{
core::GUID,
@ -25,6 +29,13 @@ fn setup(mut commands: Commands) {
if let Some(active) = active.as_ref() {
let scheme = DefaultScheme(*active);
commands.insert_resource(scheme);
ctrlc::set_handler(move || {
Power::PowerSetActiveScheme(None, Some(active))
.ok()
.expect("Failed to set power scheme");
TerminalCtrlCHandlerPlugin::gracefully_exit();
})
.expect("Failed to set exit handler");
}
}
#[cfg(not(windows))]