Skip to content

Commit

Permalink
feat: add LevelSet::from_iid method (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanhelsing committed Dec 3, 2022
1 parent 1a7a8a1 commit fb17ae1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components.rs
Expand Up @@ -45,6 +45,14 @@ pub struct LevelSet {
pub iids: HashSet<String>,
}

impl LevelSet {
pub fn from_iid<T: Into<String>>(iid: T) -> Self {
let mut iids = HashSet::default();
iids.insert(iid.into());
Self { iids }
}
}

/// [Component] that indicates that an ldtk entity should be a child of the world, not the level.
///
/// By default, [LdtkEntity]s are children of the level they spawn in.
Expand Down

0 comments on commit fb17ae1

Please sign in to comment.