diff --git a/src/map/mod.rs b/src/map/mod.rs index 3115fa1d..55711bfe 100644 --- a/src/map/mod.rs +++ b/src/map/mod.rs @@ -44,6 +44,7 @@ impl Default for TilemapRenderSettings { /// A component which stores a reference to the tilemap entity. #[derive(Component, Reflect, Clone, Copy, Debug, Hash)] #[reflect(Component, MapEntities)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TilemapId(pub Entity); impl MapEntities for TilemapId { diff --git a/src/render/extract.rs b/src/render/extract.rs index 6d0017b6..24166d47 100644 --- a/src/render/extract.rs +++ b/src/render/extract.rs @@ -1,10 +1,8 @@ use bevy::math::Affine3A; -use bevy::prelude::Res; -use bevy::prelude::Time; use bevy::render::primitives::{Aabb, Frustum}; use bevy::render::render_resource::FilterMode; use bevy::render::render_resource::TextureFormat; -use bevy::{math::Vec4, prelude::*, render::Extract, utils::HashMap}; +use bevy::{prelude::*, render::Extract, utils::HashMap}; use crate::prelude::TilemapGridSize; use crate::prelude::TilemapRenderSettings; diff --git a/src/tiles/mod.rs b/src/tiles/mod.rs index e329989a..89efb3c6 100644 --- a/src/tiles/mod.rs +++ b/src/tiles/mod.rs @@ -67,12 +67,14 @@ impl From<&TilePos> for Vec2 { /// A texture index into the atlas or texture array for a single tile. Indices in an atlas are horizontal based. #[derive(Component, Reflect, Default, Clone, Copy, Debug, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[reflect(Component)] pub struct TileTextureIndex(pub u32); /// A custom color for the tile. #[derive(Component, Reflect, Default, Clone, Copy, Debug)] #[reflect(Component)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TileColor(pub Color); impl From for TileColor { @@ -84,6 +86,7 @@ impl From for TileColor { /// Hides or shows a tile based on the boolean. Default: True #[derive(Component, Reflect, Clone, Copy, Debug, Hash)] #[reflect(Component)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TileVisible(pub bool); impl Default for TileVisible { @@ -95,6 +98,7 @@ impl Default for TileVisible { /// Flips the tiles texture along the X, Y or diagonal axes #[derive(Component, Reflect, Default, Clone, Copy, Debug, Hash)] #[reflect(Component)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TileFlip { /// Flip tile along the x axis. pub x: bool, @@ -105,6 +109,7 @@ pub struct TileFlip { /// This an optional tile bundle with default components. #[derive(Bundle, Default, Clone, Copy, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TileBundle { pub position: TilePos, pub texture_index: TileTextureIndex, @@ -117,12 +122,14 @@ pub struct TileBundle { #[derive(Component, Reflect, Default, Clone, Copy, Debug)] #[reflect(Component)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct TilePosOld(pub TilePos); /// A component that is attached to a Tile entity that /// tells the GPU how to animate the tile. /// Currently all frames must be aligned in your tilemap. #[derive(Component, Reflect, Clone, Copy, Debug)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct AnimatedTile { /// The start frame index in the tilemap atlas/array (inclusive). pub start: u32,