pico_ecs/entity.rs
1/// Entity identifier - just an index into component arrays
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub struct Entity(pub u8);
4
5impl Entity {
6 /// Create a new entity with the given ID
7 pub fn new(id: u8) -> Self {
8 Entity(id)
9 }
10
11 /// Get the entity's index
12 pub fn id(&self) -> usize {
13 self.0 as usize
14 }
15}