new rendering engine

This commit is contained in:
2026-06-19 02:55:33 +02:00
parent 0a90d6a5d7
commit 81a4167382
53 changed files with 1668 additions and 378 deletions

View File

@@ -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(())
}