mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
Add serialize/deserialize to some input types (#281)
This commit is contained in:
parent
20335d5643
commit
7a79dcc46c
4 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,8 @@ flac = ["bevy_audio/flac"]
|
||||||
wav = ["bevy_audio/wav"]
|
wav = ["bevy_audio/wav"]
|
||||||
vorbis = ["bevy_audio/vorbis"]
|
vorbis = ["bevy_audio/vorbis"]
|
||||||
|
|
||||||
|
serialize = ["bevy_input/serialize"]
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"crates/*",
|
"crates/*",
|
||||||
|
|
|
@ -9,7 +9,12 @@ repository = "https://github.com/bevyengine/bevy"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
keywords = ["bevy"]
|
keywords = ["bevy"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
serialize = ["serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_app = { path = "../bevy_app", version = "0.1" }
|
bevy_app = { path = "../bevy_app", version = "0.1" }
|
||||||
bevy_ecs = { path = "../bevy_ecs", version = "0.1" }
|
bevy_ecs = { path = "../bevy_ecs", version = "0.1" }
|
||||||
bevy_math = { path = "../bevy_math", version = "0.1" }
|
bevy_math = { path = "../bevy_math", version = "0.1" }
|
||||||
|
serde = { version = "1", features = ["derive"], optional = true }
|
||||||
|
|
|
@ -56,6 +56,7 @@ pub fn keyboard_input_system(
|
||||||
|
|
||||||
/// The key code of a keyboard input.
|
/// The key code of a keyboard input.
|
||||||
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
|
||||||
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum KeyCode {
|
pub enum KeyCode {
|
||||||
/// The '1' key over the letters.
|
/// The '1' key over the letters.
|
||||||
|
|
|
@ -13,6 +13,7 @@ pub struct MouseButtonInput {
|
||||||
|
|
||||||
/// A button on a mouse device
|
/// A button on a mouse device
|
||||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
|
||||||
|
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum MouseButton {
|
pub enum MouseButton {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
|
|
Loading…
Reference in a new issue