From 0fbd2320aaef17ccfb28d8356aaaa3f775a5bd91 Mon Sep 17 00:00:00 2001 From: Atlas16A Date: Mon, 17 Feb 2025 20:07:40 -0500 Subject: [PATCH] Add Bevy_state to bevy_window and make CursorGrabMode a state --- crates/bevy_window/Cargo.toml | 1 + crates/bevy_window/src/window.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_window/Cargo.toml b/crates/bevy_window/Cargo.toml index eb6dd3d782e81..d948cfdaf6e24 100644 --- a/crates/bevy_window/Cargo.toml +++ b/crates/bevy_window/Cargo.toml @@ -60,6 +60,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.16.0-dev", default-featu ], optional = true } bevy_utils = { path = "../bevy_utils", version = "0.16.0-dev", default-features = false } bevy_platform_support = { path = "../bevy_platform_support", version = "0.16.0-dev", default-features = false } +bevy_state = { path = "../bevy_state", version = "0.16.0-dev", default-features = false } # other serde = { version = "1.0", features = [ diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 1acf96ee416ac..12d81d0660090 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -1,4 +1,5 @@ use alloc::{borrow::ToOwned, string::String}; +use bevy_state::state::States; use core::num::NonZero; use bevy_ecs::{ @@ -1031,7 +1032,7 @@ impl From for WindowResolution { /// - **`iOS/Android`** don't have cursors. /// /// Since `Windows` and `macOS` have different [`CursorGrabMode`] support, we first try to set the grab mode that was asked for. If it doesn't work then use the alternate grab mode. -#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Default, States, Hash, Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr( feature = "bevy_reflect", derive(Reflect),