use dotmax::prelude::*;
use std::thread;
use std::time::Duration;
fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_max_level(tracing::Level::DEBUG)
.init();
println!("=== Simple Viewport Test ===\n");
let mut renderer = TerminalRenderer::new()?;
let (term_width, term_height) = renderer.get_terminal_size()?;
println!("Terminal reports: {term_width}×{term_height}");
let mut grid = BrailleGrid::new(term_width as usize, term_height as usize)?;
println!("Grid created: {}×{} cells", grid.width(), grid.height());
let dot_width = grid.width() * 2;
let dot_height = grid.height() * 4;
println!("Drawing 3 horizontal lines:");
println!(" - Top line at dot Y=0");
println!(" - Middle line at dot Y={}", dot_height / 2);
println!(" - Bottom line at dot Y={}", dot_height - 1);
for x in 0..dot_width {
grid.set_dot(x, 0)?;
}
for x in 0..dot_width {
grid.set_dot(x, dot_height / 2)?;
}
for x in 0..dot_width {
grid.set_dot(x, dot_height - 1)?;
}
println!("\nRendering... (check debug logs for 'Rendering area')");
renderer.render(&grid)?;
println!("\n❓ What do you see?");
println!(" Expected: 3 horizontal lines (top, middle, bottom)");
println!(" If you only see 2 lines → the grid is bigger than viewport");
thread::sleep(Duration::from_secs(15));
renderer.cleanup()?;
Ok(())
}