Skip to content

Commit

Permalink
Serde impl (again) (#31)
Browse files Browse the repository at this point in the history
Adds optional serde dependency
Implementing Deserialize and Serialize for EaseFunction
  • Loading branch information
Multirious authored Jun 11, 2024
1 parent db5f755 commit 7ae7962
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bevy = { version = "0.13.0", default-features = false }
bevy_time_runner = { version = "0.1.4", default-features = false, features = ["bevy_app", "bevy_reflect"] }
bevy_lookup_curve = { version = "0.2.1", optional = true }
bevy_eventlistener = { version = "0.7.0", optional = true }
serde = { version = "1", optional = true, features = ["derive"] }

[dev-dependencies]
bevy-inspector-egui = "0.23"
Expand Down Expand Up @@ -50,6 +51,8 @@ bevy_sprite = [ "bevy/bevy_sprite", "bevy_render" ]
bevy_eventlistener = [ "dep:bevy_eventlistener", "bevy_time_runner/bevy_eventlistener" ]
# Supports for `bevy_lookup_curve` (https://github.com/villor/bevy_lookup_curve)
bevy_lookup_curve = [ "dep:bevy_lookup_curve" ]
# Derive Serialize and Deserialize for some types
serde = [ "dep:serde" ]

[package.metadata.docs.rs]
all-features = true
Expand Down
3 changes: 3 additions & 0 deletions src/interpolation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use bevy::prelude::*;

use crate::{tween::TweenInterpolationValue, TweenSystemSet};
use bevy_time_runner::TimeSpanProgress;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

#[cfg(feature = "bevy_lookup_curve")]
pub mod bevy_lookup_curve;
Expand Down Expand Up @@ -59,6 +61,7 @@ impl Plugin for EaseFunctionPlugin {
#[allow(missing_docs)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Component, Reflect)]
#[reflect(Component)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub enum EaseFunction {
#[default]
/// ```txt
Expand Down

0 comments on commit 7ae7962

Please sign in to comment.