diff options
author | Griffin Smith <root@gws.fyi> | 2019-07-09T00·58-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-07-09T00·58-0400 |
commit | 5af2429ecb5742383cf0798ce23682d316bdb24d (patch) | |
tree | 0fba959d9a5bce5c749c8529b3f2ea7b557c5767 /src/display/mod.rs | |
parent | 20f1ccb4600b88ac01768e912e6d5837534ca852 (diff) |
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.
Diffstat (limited to 'src/display/mod.rs')
-rw-r--r-- | src/display/mod.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs index 664aaf319cc7..9e15a0d97d62 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -14,5 +14,17 @@ pub fn clear<T: Write>(out: &mut T) -> io::Result<()> { pub trait Draw: Positioned { /// Draw this entity, assuming the character is already at the correct /// position - fn do_draw<W: Write>(&self, out: &mut W) -> io::Result<()>; + fn do_draw(&self, out: &mut Write) -> io::Result<()>; +} + +impl<T : Draw> Draw for &T { + fn do_draw(&self, out: &mut Write) -> io::Result<()> { + (**self).do_draw(out) + } +} + +impl<T : Draw> Draw for Box<T> { + fn do_draw(&self, out: &mut Write) -> io::Result<()> { + (**self).do_draw(out) + } } |