From 7673db731e7de0039dd97aa9c1b4ddf675ef9d60 Mon Sep 17 00:00:00 2001 From: Emerson MX Date: Mon, 10 Oct 2022 23:59:27 +0000 Subject: [PATCH] Make TouchInput and ForceTouch serializable (#6191) Closes #6021 --- crates/bevy_input/src/touch.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/bevy_input/src/touch.rs b/crates/bevy_input/src/touch.rs index 3b43a7c7e377c..be88d897d1bbd 100644 --- a/crates/bevy_input/src/touch.rs +++ b/crates/bevy_input/src/touch.rs @@ -27,6 +27,7 @@ use bevy_utils::HashMap; /// This event is the translated version of the `WindowEvent::Touch` from the `winit` crate. /// It is available to the end user and can be used for game logic. #[derive(Debug, Clone, Copy, PartialEq)] +#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub struct TouchInput { /// The phase of the touch input. pub phase: TouchPhase, @@ -43,6 +44,7 @@ pub struct TouchInput { /// A force description of a [`Touch`](crate::touch::Touch) input. #[derive(Debug, Clone, Copy, PartialEq)] +#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub enum ForceTouch { /// On iOS, the force is calibrated so that the same number corresponds to /// roughly the same amount of pressure on the screen regardless of the