Create an early scripting engine #2

Merged
SeanOMik merged 42 commits from feature/early-scripting into main 2024-03-03 03:28:57 +00:00
3 changed files with 27 additions and 0 deletions
Showing only changes of commit acfd238274 - Show all commits

View File

@ -5,10 +5,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
math = ["dep:glam"]
[dependencies]
lyra-ecs-derive = { path = "./lyra-ecs-derive" }
anyhow = "1.0.75"
thiserror = "1.0.50"
glam = { version = "0.24.0", optional = true }
[dev-dependencies]
rand = "0.8.5" # used for tests

View File

@ -34,6 +34,10 @@ pub mod system;
pub mod tick;
pub use tick::*;
/// Implements Component for glam math types
#[cfg(feature = "math")]
pub mod math;
pub use lyra_ecs_derive::*;
#[cfg(test)]

19
lyra-ecs/src/math.rs Normal file
View File

@ -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);