|
@@ -43,6 +43,9 @@ macro_rules! system_impl {
|
|
|
|
|
|
#[macro_export]
|
|
|
macro_rules! args_to_systemdata {
|
|
|
+ ( ( $name:ident : Entity $(,)? ) ) => {
|
|
|
+ ( specs::Entities<'a>, )
|
|
|
+ };
|
|
|
( ( $name:ident : $ty:ty $(,)? ) ) => {
|
|
|
( specs::ReadStorage<'a, $ty> ,)
|
|
|
};
|
|
@@ -55,6 +58,9 @@ macro_rules! args_to_systemdata {
|
|
|
( ( resource mut $name:ident : $ty:ty $(,)? ) ) => {
|
|
|
compile_error!("Resources cannot come at the end of the argument block.")
|
|
|
};
|
|
|
+ ( ( $name:ident : Entity , $($tok:tt)* ) ) => {
|
|
|
+ ( specs::Entities<'a>, args_to_systemdata!( ( $( $tok )* ) ) )
|
|
|
+ };
|
|
|
( ( $name:ident : $ty:ty , $($tok:tt)* ) ) => {
|
|
|
( specs::ReadStorage<'a, $ty>, args_to_systemdata!( ( $( $tok )* ) ) )
|
|
|
};
|
|
@@ -153,7 +159,6 @@ macro_rules! args_to_join {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-
|
|
|
#[cfg(test)]
|
|
|
mod tests {
|
|
|
|
|
@@ -232,4 +237,18 @@ mod tests {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ system! {
|
|
|
+ Pippo (_e: Entity, _x: Mov, mut y: Pos) {
|
|
|
+ y.x += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ system_impl! {
|
|
|
+ PippoAlt (_e: Entity, x: Mov, mut y: Pos) {
|
|
|
+ for (_, mut y) in (&x, &mut y).join() {
|
|
|
+ y.x += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|