diff options
author | Griffin Smith <root@gws.fyi> | 2019-07-06T19·32-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-07-06T19·32-0400 |
commit | 78a52142d191d25a74cb2124d5cca8a69d51ba7f (patch) | |
tree | dd023a823bae6cc427e32a497bd68db85bbfab4b /src/display/mod.rs | |
parent | de081d7b1d0b791b2e61f9cde7369ea11647e0ae (diff) |
Make all drawing happen to a viewport
We now have an inner and outer viewport, and entity positions are relative to the inner one while drawing happens to the outer one.
Diffstat (limited to 'src/display/mod.rs')
-rw-r--r-- | src/display/mod.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs index 5dba48b44d9a..664aaf319cc7 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -1,9 +1,18 @@ pub mod draw_box; pub mod utils; +pub mod viewport; +use crate::types::Positioned; pub use draw_box::{make_box, BoxStyle}; use std::io::{self, Write}; use termion::{clear, cursor, style}; +pub use viewport::Viewport; pub fn clear<T: Write>(out: &mut T) -> io::Result<()> { write!(out, "{}{}{}", clear::All, style::Reset, cursor::Goto(1, 1)) } + +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<()>; +} |