Switch to persistent printer with queue
This commit is contained in:
parent
0ea4cf1d22
commit
6555e9c0bd
14 changed files with 221 additions and 76 deletions
|
|
@ -8,14 +8,14 @@ use taffy::{
|
|||
style_helpers::{length, percent, repeat},
|
||||
};
|
||||
|
||||
use crate::printer::Printer;
|
||||
use crate::persistent_printer::PersistentPrinter;
|
||||
|
||||
use super::{Context, Drawing};
|
||||
use super::{Context, Drawing, FEED};
|
||||
|
||||
pub struct TicTacToeDrawing;
|
||||
|
||||
impl Drawing for TicTacToeDrawing {
|
||||
fn draw(&self, printer: &mut Printer, ctx: &mut Context) -> anyhow::Result<()> {
|
||||
fn draw(&self, printer: &mut PersistentPrinter, ctx: &mut Context) -> anyhow::Result<()> {
|
||||
let block_size = length(128.0);
|
||||
let width = length(2.0);
|
||||
|
||||
|
|
@ -57,6 +57,7 @@ impl Drawing for TicTacToeDrawing {
|
|||
|
||||
let root = Node::empty()
|
||||
.with_size_width(percent(1.0))
|
||||
.with_padding_bottom(length(FEED))
|
||||
.with_display(Display::Flex)
|
||||
.with_flex_direction(FlexDirection::Column)
|
||||
.with_align_items(Some(AlignItems::Center))
|
||||
|
|
@ -66,7 +67,6 @@ impl Drawing for TicTacToeDrawing {
|
|||
.register(&mut tree)?;
|
||||
|
||||
printer.print_tree(&mut tree, ctx, root)?;
|
||||
printer.feed()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue