Create an early scripting engine #2
|
@ -5,10 +5,14 @@ edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[features]
|
||||||
|
math = ["dep:glam"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lyra-ecs-derive = { path = "./lyra-ecs-derive" }
|
lyra-ecs-derive = { path = "./lyra-ecs-derive" }
|
||||||
anyhow = "1.0.75"
|
anyhow = "1.0.75"
|
||||||
thiserror = "1.0.50"
|
thiserror = "1.0.50"
|
||||||
|
glam = { version = "0.24.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.8.5" # used for tests
|
rand = "0.8.5" # used for tests
|
||||||
|
|
|
@ -34,6 +34,10 @@ pub mod system;
|
||||||
pub mod tick;
|
pub mod tick;
|
||||||
pub use tick::*;
|
pub use tick::*;
|
||||||
|
|
||||||
|
/// Implements Component for glam math types
|
||||||
|
#[cfg(feature = "math")]
|
||||||
|
pub mod math;
|
||||||
|
|
||||||
pub use lyra_ecs_derive::*;
|
pub use lyra_ecs_derive::*;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
use crate::Component;
|
||||||
|
|
||||||
|
use glam::{Vec3, Quat, Vec2, Vec4, Mat4};
|
||||||
|
|
||||||
|
macro_rules! impl_component_math {
|
||||||
|
($type: ident) => {
|
||||||
|
impl Component for $type {
|
||||||
|
fn name() -> &'static str {
|
||||||
|
stringify!($type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
impl_component_math!(Vec2);
|
||||||
|
impl_component_math!(Vec3);
|
||||||
|
impl_component_math!(Vec4);
|
||||||
|
impl_component_math!(Mat4);
|
||||||
|
impl_component_math!(Quat);
|
Loading…
Reference in New Issue