Use frame stack instead of explicit pos and size parameters

This commit is contained in:
Joscha 2022-07-13 11:34:31 +02:00
parent 44470b973d
commit 9aed0a3cee
9 changed files with 22 additions and 15 deletions

View file

@ -24,13 +24,14 @@ impl Widget for Background {
self.inner.size(frame, max_width, max_height)
}
async fn render(self: Box<Self>, frame: &mut Frame, pos: Pos, size: Size) {
async fn render(self: Box<Self>, frame: &mut Frame) {
let size = frame.size();
for dy in 0..size.height {
for dx in 0..size.width {
frame.write(pos + Pos::new(dx.into(), dy.into()), (" ", self.style));
frame.write(Pos::new(dx.into(), dy.into()), (" ", self.style));
}
}
self.inner.render(frame, pos, size).await;
self.inner.render(frame).await;
}
}