use ibm437::framebuffer::FbFont;
fn main() {
const WIDTH: usize = 640;
const HEIGHT: usize = 200;
let mut buffer = vec![0x00_10_10_30u32; WIDTH * HEIGHT];
let regular = FbFont::regular_8x8();
let bold = FbFont::bold_8x8();
let large = FbFont::regular_9x14();
let white = 0x00FF_FFFF;
let yellow = 0x00FF_FF00;
let cyan = 0x0000_FFFF;
let bg_blue = Some(0x0000_0080);
regular.draw_str(
&mut buffer,
WIDTH,
10,
10,
"IBM437 8\u{00D7}8 regular",
white,
None,
);
bold.draw_str(
&mut buffer,
WIDTH,
10,
22,
"IBM437 8\u{00D7}8 bold",
yellow,
None,
);
large.draw_str(
&mut buffer,
WIDTH,
10,
34,
"IBM437 9\u{00D7}14 regular",
cyan,
None,
);
large.draw_str(
&mut buffer,
WIDTH,
10,
60,
"\u{250C}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2510}",
white,
bg_blue,
);
large.draw_str(
&mut buffer,
WIDTH,
10,
74,
"\u{2502} Hello, framebuffer \u{2502}",
white,
bg_blue,
);
large.draw_str(
&mut buffer,
WIDTH,
10,
88,
"\u{2514}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2518}",
white,
bg_blue,
);
regular.draw_str(
&mut buffer,
WIDTH,
10,
120,
"The buffer is a plain &mut [u32] \u{2014} use it with minifb, softbuffer, SDL2\u{2026}",
0x00AA_AAAA,
None,
);
let big = FbFont::regular_8x8().with_scale(3);
big.draw_str(
&mut buffer,
WIDTH,
10,
145,
"SCALED 3\u{00D7}",
yellow,
None,
);
println!(
"Buffer filled ({}\u{00D7}{}, {} pixels). Plug it into your windowing library!",
WIDTH,
HEIGHT,
buffer.len()
);
}