#[cfg(feature = "default")]
extern crate sensehat_screen;
#[cfg(feature = "default")]
use sensehat_screen::Offset;
#[cfg(feature = "default")]
use sensehat_screen::{font_to_pixel_frame, FontCollection, PixelColor, PixelFrame, Screen};
#[cfg(not(feature = "default"))]
fn main() {
unimplemented!("This examples needs the 'default' features.");
}
#[cfg(feature = "default")]
fn main() {
let mut screen = Screen::open("/dev/fb1").unwrap();
let fonts = FontCollection::new();
for &(sym, color) in &[('þ', PixelColor::CYAN), ('ß', PixelColor::WHITE.dim(0.5))] {
let font = fonts.get(sym).unwrap();
let symbol = font_to_pixel_frame(font.byte_array(), color);
for i in 0..=8 {
screen.write_frame(&symbol.offset(Offset::left(8 - i)).frame_line());
::std::thread::sleep(::std::time::Duration::from_millis(500));
}
for i in 0..=8 {
screen.write_frame(&symbol.offset(Offset::right(i)).frame_line());
::std::thread::sleep(::std::time::Duration::from_millis(500));
}
for i in 0..=8 {
screen.write_frame(&symbol.offset(Offset::top(8 - i)).frame_line());
::std::thread::sleep(::std::time::Duration::from_millis(500));
}
for i in 0..=8 {
screen.write_frame(&symbol.offset(Offset::bottom(i)).frame_line());
::std::thread::sleep(::std::time::Duration::from_millis(500));
}
}
screen.write_frame(&PixelFrame::new(&[PixelColor::BLACK; 64]).frame_line());
}