commit ff74bf29ba37d30aab1952ddea61bc9eaa14f881 Author: Nolan Darilek Date: Wed Jan 19 14:52:52 2022 -0600 Initial commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a9d37c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a468072 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "bevy_full_throttle" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +bevy = { version = "0.6", default-features = false } + +[target.'cfg(windows)'.dependencies] +windows = { version = "0.30", features = ["Win32_System_Power", "Win32_System_Registry", "Win32_System_SystemServices"] } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..de7b78a --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,18 @@ +use bevy::prelude::*; +#[cfg(windows)] +use windows::Win32::System::{Power, SystemServices::GUID_MIN_POWER_SAVINGS}; + +fn setup() { + #[cfg(windows)] + unsafe { + Power::PowerSetActiveScheme(None, &GUID_MIN_POWER_SAVINGS); + } +} + +pub struct FullThrottlePlugin; + +impl Plugin for FullThrottlePlugin { + fn build(&self, app: &mut App) { + app.add_startup_system(setup); + } +}