Make TouchInput and ForceTouch serializable (#6191)

Closes #6021
This commit is contained in:
Emerson MX 2022-10-10 23:59:27 +00:00
parent 1ca1c8c39e
commit 7673db731e

View file

@ -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