pub fn add_entity(&mut self) -> Entity {
        // Get the idx.
        let idx = match self.reusable_idxs.pop() {
            None => {
                // No reusable idxs, so make a new one.
                let idx = self.next_idx;
                self.next_idx += 1;
                // And add a new entry to the components vector.
                self.components.push(AnyMap::new());
                idx
            },
            Some(idx) => idx,
        };

        // Get the uuid.
        let uuid = self.next_uuid;
        self.next_uuid += 1;

        // Register the entity as active.
        if self.active.len() <= uuid {
            self.active.resize(uuid + 1, 0);
        }
        self.active[idx] = uuid;

        // Register the entity as newly added.
        self.ent_added.insert(idx, uuid);

        Entity { idx: idx, uuid: uuid }
    }
/// Adds a new entity.
/// Will reuse an idx if available, if not it will increment the idx counter and allocate
/// space for the components.
/// The new entity will only show up in the iterator and list after
/// `confirm_changes()` is called.
Adds a new entity.
Will reuse an idx if available, if not it will increment the idx counter and allocate
space for the components.
The new entity will only show up in the iterator and list after
`confirm_changes()` is called.
Adds a new entity . Will reuse an idx if available if not it will increment the idx counter and allocate space for the components . The new entity will only show up in the iterator and list after ` confirm_changes () ` is called .
pub fn add_entity(&mut self) -> Entity {
        // Get the idx.
        let idx = match self.reusable_idxs.pop() {
            None => {
                // No reusable idxs, so make a new one.
                let idx = self.next_idx;
                self.next_idx += 1;
                // And add a new entry to the components vector.
                self.components.push(AnyMap::new());
                idx
            },
            Some(idx) => idx,
        };
        // Get the uuid.
        let uuid = self.next_uuid;
        self.next_uuid += 1;
        // Register the entity as active.
        if self.active.len() <= uuid {
            self.active.resize(uuid + 1, 0);
        }
        self.active[idx] = uuid;
        // Register the entity as newly added.
        self.ent_added.insert(idx, uuid);
        Entity { idx: idx, uuid: uuid }
    }
pub fn add_entity ( & mut self ) -> Entity { // Get the idx. let idx = match self . reusable_idxs . pop ( ) { None => { // No reusable idxs, so make a new one. let idx = self . next_idx ; self . next_idx += 1 ; // And add a new entry to the components vector. self . components . push ( AnyMap :: new ( ) ) ; idx } , Some ( idx ) => idx , } ; // Get the uuid. let uuid = self . next_uuid ; self . next_uuid += 1 ; // Register the entity as active. if self . active . len ( ) <= uuid { self . active . resize ( uuid + 1 , 0 ) ; } self . active [ idx ] = uuid ; // Register the entity as newly added. self . ent_added . insert ( idx , uuid ) ; Entity { idx : idx , uuid : uuid } }
Adds a new entity.
Adds a new entity .
&mut self
&mut self