print all strings
This commit is contained in:
parent
e159df38cc
commit
66429e6714
@ -20,8 +20,50 @@ pub extern "C" fn rust_sneakers_effect() {
|
||||
println!("Rust sneakers effect");
|
||||
use std::time::Duration;
|
||||
|
||||
let (term_width, _term_height) = crossterm::terminal::size().expect("Error reading terminal size");
|
||||
let term_width = term_width as usize;
|
||||
let mut buf = String::new();
|
||||
|
||||
buf.push_str(head1Left);
|
||||
let spaces = term_width - head1Left.len() - head1Right.len();
|
||||
buf.push_str(&" ".repeat(spaces));
|
||||
buf.push_str(head1Right);
|
||||
buf.push('\n');
|
||||
|
||||
for text in [head2Center, head3Center].iter(){
|
||||
let spaces = ((term_width - text.len()) / 2);
|
||||
buf.push_str(&" ".repeat(spaces));
|
||||
buf.push_str(text);
|
||||
buf.push_str("\n\n");
|
||||
};
|
||||
|
||||
for text in [head4Center, head5Center].iter(){
|
||||
let spaces = ((term_width - text.len()) / 2);
|
||||
buf.push_str(&" ".repeat(spaces));
|
||||
buf.push_str(text);
|
||||
buf.push('\n');
|
||||
};
|
||||
|
||||
buf.push('\n');
|
||||
|
||||
for text in [menu1, menu2, menu3, menu4, menu5, menu6].iter() {
|
||||
let spaces = ((term_width - head5Center.len()) / 2) + 3;
|
||||
buf.push_str(&" ".repeat(spaces));
|
||||
buf.push_str(text);
|
||||
buf.push('\n');
|
||||
}
|
||||
|
||||
for text in [foot1Center, foot2Center].iter() {
|
||||
let spaces = ((term_width - text.len()) / 2);
|
||||
buf.push('\n');
|
||||
buf.push_str(&" ".repeat(spaces));
|
||||
buf.push_str(text);
|
||||
buf.push('\n');
|
||||
};
|
||||
|
||||
println!("{}", buf);
|
||||
|
||||
let dur = Duration::from_millis(2000);
|
||||
std::thread::sleep(dur);
|
||||
|
||||
let mut buf = String::new();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user