feat: implemented a Camera2D component that works with the Renderer2D

Renders with only one camera (the first by ID) rn but should work
This commit is contained in:
lisk77 2025-03-07 23:42:12 +01:00
parent e6df3dba91
commit 8b439cb0e8
4 changed files with 178 additions and 45 deletions

View file

@ -204,9 +204,9 @@ impl World {
}
/// Returns a list of entities that have the given components.
pub fn get_entities_with(&self, components: ComponentSet) -> Vec<u32> {
pub fn get_entities_with(&self, components: ComponentSet) -> Vec<usize> {
if self.archetypes.contains_archetype(&components) {
return self.archetypes.get_archetype(&components).unwrap().clone();
return self.archetypes.get_archetype(&components).unwrap().clone().iter().map(|x| *x as usize).collect();
}
error!("The given components {:?} are not registered in the world!", components);
Vec::new()