Implement a function for drawing components
This commit is contained in:
parent
a9e2f628ad
commit
2a7c035a42
1 changed files with 8 additions and 0 deletions
|
@ -2,6 +2,14 @@ pub struct Screen {
|
|||
pub components: Vec<Box<dyn Draw>>,
|
||||
}
|
||||
|
||||
impl Screen {
|
||||
pub fn run(&self) {
|
||||
for component in self.components.iter() {
|
||||
component.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Draw {
|
||||
fn draw(&self);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue