Skip to content

Commit

Permalink
Add serialize/deserialize to some input types (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
TehPers authored Aug 22, 2020
1 parent 20335d5 commit 7a79dcc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ flac = ["bevy_audio/flac"]
wav = ["bevy_audio/wav"]
vorbis = ["bevy_audio/vorbis"]

serialize = ["bevy_input/serialize"]

[workspace]
members = [
"crates/*",
Expand Down
5 changes: 5 additions & 0 deletions crates/bevy_input/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ repository = "https://github.com/bevyengine/bevy"
license = "MIT"
keywords = ["bevy"]

[features]
default = []
serialize = ["serde"]

[dependencies]
bevy_app = { path = "../bevy_app", version = "0.1" }
bevy_ecs = { path = "../bevy_ecs", version = "0.1" }
bevy_math = { path = "../bevy_math", version = "0.1" }
serde = { version = "1", features = ["derive"], optional = true }
1 change: 1 addition & 0 deletions crates/bevy_input/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub fn keyboard_input_system(

/// The key code of a keyboard input.
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[repr(u32)]
pub enum KeyCode {
/// The '1' key over the letters.
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_input/src/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct MouseButtonInput {

/// A button on a mouse device
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
pub enum MouseButton {
Left,
Right,
Expand Down

0 comments on commit 7a79dcc

Please sign in to comment.