new rendering engine
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use client_domain::{BoundingBox, DisplayPort};
|
||||
use client_domain::{BoundingBox, Color, DisplayPort, FontSize};
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TerminalDisplay;
|
||||
@@ -12,37 +12,25 @@ impl TerminalDisplay {
|
||||
impl DisplayPort for TerminalDisplay {
|
||||
type Error = std::io::Error;
|
||||
|
||||
fn clear_region(&mut self, bounds: BoundingBox) -> Result<(), Self::Error> {
|
||||
println!(
|
||||
"[CLEAR] ({}, {}) {}x{}",
|
||||
bounds.x, bounds.y, bounds.width, bounds.height
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn draw_text(
|
||||
fn draw_text_span(
|
||||
&mut self,
|
||||
text: &str,
|
||||
x: u16,
|
||||
y: u16,
|
||||
bounds: BoundingBox,
|
||||
color: Color,
|
||||
font: FontSize,
|
||||
) -> Result<(), Self::Error> {
|
||||
println!(
|
||||
"[TEXT] ({x}, {y}) in {}x{}: \"{text}\"",
|
||||
bounds.width, bounds.height
|
||||
"[TEXT] ({x}, {y}) {:?} #{:02X}{:02X}{:02X}: \"{text}\"",
|
||||
font, color.0, color.1, color.2
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn draw_icon(&mut self, icon: &str, x: u16, y: u16) -> Result<(), Self::Error> {
|
||||
println!("[ICON] ({x}, {y}): {icon}");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn fill_background(&mut self, bounds: BoundingBox) -> Result<(), Self::Error> {
|
||||
fn fill_rect(&mut self, bounds: BoundingBox, color: Color) -> Result<(), Self::Error> {
|
||||
println!(
|
||||
"[BG] ({}, {}) {}x{}",
|
||||
bounds.x, bounds.y, bounds.width, bounds.height
|
||||
"[FILL] ({}, {}) {}x{} #{:02X}{:02X}{:02X}",
|
||||
bounds.x, bounds.y, bounds.width, bounds.height, color.0, color.1, color.2
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user