shell: add monstera

This commit is contained in:
Michael Sippel 2021-08-11 17:56:42 +02:00
parent 07ee04bba4
commit 316b332d4a
Signed by: senvas
GPG key ID: F96CF119C34B64A6
2 changed files with 59 additions and 3 deletions

View file

@ -1,5 +1,5 @@
//mod monstera;
mod monstera;
use{
std::sync::{Arc, RwLock},
@ -287,11 +287,11 @@ write::
{
compositor.write().unwrap().push(magic.offset(Vector2::new(40, 4)));
//compositor.write().unwrap().push(magic.offset(Vector2::new(40, 20)));
/*
let monstera_port = monstera::make_monstera();
compositor.write().unwrap().push(monstera_port.clone());
compositor.write().unwrap().push(monstera_port.offset(Vector2::new(83,0)));
*/
}
/*

56
shell/src/monstera.rs Normal file
View file

@ -0,0 +1,56 @@
use {
cgmath::Point2,
nested::{
core::{ViewPort, OuterViewPort},
vec::VecBuffer,
terminal::{
TerminalStyle, TerminalView, make_label
},
}
};
pub fn make_monstera() -> OuterViewPort<dyn TerminalView> {
let monstera_lines_port = ViewPort::new();
let monstera_lines = VecBuffer::with_data(
vec![
make_label(" |"),
make_label(" |"),
make_label(" _..._ | _..._"),
make_label(" .( \\|/ )."),
make_label(" ( | )"),
make_label(" .__>. <> | <> .<__."),
make_label(" / | \\"),
make_label(" | .___ _ | _ ___. |"),
make_label(" _./___>. / \\ | / \\ .<___\\._ "),
make_label(" / \\_/ | \\_/ \\"),
make_label(" ( .____. | .____. )"),
make_label(" ( /____ \\ _ | _ / ____\\ )"),
make_label(" _* \\.) / \\ | / \\ (./ *_"),
make_label(" / \\_/ | \\_/ \\"),
make_label(" ( .__. | .__. )"),
make_label(" ( / __ \\ | / __ \\ )"),
make_label(" * / \\.) O | O (./ \\ *"),
make_label(" / .___. | .___. \\"),
make_label(" ( / .---\\ | /---. \\ )"),
make_label(" *. ( | ) .*"),
make_label(" \\_ . | . _/"),
make_label(" \\ | /"),
make_label(" .")
],
monstera_lines_port.inner()
);
monstera_lines_port.outer()
.to_sequence()
.to_index()
.map_key(
|idx| Point2::new(0 as i16, *idx as i16),
|pt| if pt.x == 0 { Some(pt.y as usize) } else { None }
)
.flatten()
.map_item(
|p, at| at.add_style_back(TerminalStyle::fg_color((0,100,10)))
)
}