Implement a global map of entities

Implement a global map of entities, which allows referencing by either
position or ID and updating the positions of existent entities, and put
the character in there.
This commit is contained in:
Griffin Smith 2019-07-08 20:58:51 -04:00
parent 20f1ccb460
commit 5af2429ecb
14 changed files with 465 additions and 36 deletions

View file

@ -1,2 +1,16 @@
pub mod character;
use crate::display::Draw;
use crate::types::{Positioned, PositionedMut};
pub use character::Character;
use downcast_rs::Downcast;
use std::io::{self, Write};
pub trait Entity: Positioned + PositionedMut + Draw + Downcast {}
impl_downcast!(Entity);
impl Draw for Box<dyn Entity> {
fn do_draw(&self, out: &mut Write) -> io::Result<()> {
(**self).do_draw(out)
}
}