6个版本
0.3.0 | 2022年8月15日 |
---|---|
0.2.1 | 2022年8月15日 |
0.1.2 | 2022年8月14日 |
#1651 在 游戏开发
每月 25次下载
14KB
208 行
bevy_mod_check_filter
一个查询过滤器,允许使用Enabled
风格的标记组件,而不会失去ZST
风格标记组件过滤的易用性!
示例
没有使用bevy_mod_check_filter
#[derive(Component)]
struct Poisoned;
#[derive(Component)]
struct Name { name: &'static str }
fn all_poisoned(entities: Query<&Name, With<Poisoned>>) {
// ...
}
使用bevy_mod_check_filter
#[derive(Component)]
struct Poisoned(pub bool);
impl std::ops::Deref for Poisoned {
type Target = bool;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Component)]
struct Name { name: &'static str }
fn all_poisoned(entities: Query<&Name, Check<Poisoned, Is<true>>>) {
// ...
}
// OR with one of the provided type aliases:
fn find_poisoned(entities: Query<&Name, IsTrue<Poisoned>>) {
// ...
}
许可证
此存储库中的所有代码均根据以下任一许可证双许可:
- MIT许可证(LICENSE-MIT文件或http://opensource.org/licenses/MIT)
- Apache许可证,版本2.0(LICENSE-APACHE文件或https://apache.ac.cn/licenses/LICENSE-2.0)
依赖关系
~7–14MB
~172K SLoC