use std::thread;
use std::time::Duration;
use gilt::console::Console;
use gilt::screen::Screen;
use gilt::style::Style;
use gilt::text::Text;
fn main() {
let width = 80;
let height = 24;
let mut console = Console::builder()
.width(width)
.height(height)
.force_terminal(true)
.no_color(false)
.build();
console.enter_screen(true);
console.clear();
let mut content = Text::empty();
let vertical_pad = height / 2 - 2;
for _ in 0..vertical_pad {
content.append_str("\n", None);
}
let message = format!("{:^width$}\n", "DON'T PANIC!", width = width);
content.append_str(&message, Some(Style::parse("bold yellow on blue")));
content.append_str(&format!("{:^width$}\n", "", width = width), None);
let sub = format!(
"{:^width$}\n",
"-- The Hitchhiker's Guide to the Galaxy",
width = width
);
content.append_str(&sub, Some(Style::parse("italic white")));
content.append_str(&format!("{:^width$}\n", "", width = width), None);
let hint = format!("{:^width$}", "Exiting in 3 seconds...", width = width);
content.append_str(&hint, Some(Style::parse("dim")));
let screen = Screen::new(content);
console.print(&screen);
thread::sleep(Duration::from_secs(3));
console.exit_screen(true);
println!("Back to reality.");
}