console
:~$ cargo install termi-graphics
console
:~$ git clone https://github.com/l-tools/termi-graphics termi-graphics
:~$ cd termi-graphics
:~$ cargo build
rust
extern crate termi_graphics;
use termi_graphics::pixel_art; //this is the most basic useable part of the crate
rust
fn main(){
let mut shape1 = Vec::new();
//smily face
shape1.push(vec![2,2,0,2,2]);
shape1.push(vec![2,2,0,2,2]);
shape1.push(vec![0,0,0,0,0]);
shape1.push(vec![0,0,1,0,0]);
shape1.push(vec![8,0,0,0,8]);
shape1.push(vec![8,8,8,8,8]);
screen1.attach_pixels(&shape1,1,1).unwrap();
//simply print it once:
screen1.print_screen();
//or present it by animation:
let vecan = vec![screen1];
use termi_graphics::animation::Animation;
let anim = Animation::new(vecan,15,3);
}
rust
fn main(){
use termi_graphics::Shapes::{rectangle,line,sqaure,triangle};
let shape2 =square(2,PixelColors::Blue).unwrap() ;
let shape3 =line(5,PixelColors::White,false).unwrap();
let shape4 =square(1,PixelColors::Red).unwrap();
let shape5 =rectangle(9,10,PixelColors::Magenta).unwrap();
let shape6 =triangle(9,PixelColors::Magenta).unwrap();
let mut vecer = Vec::new();
vecer.push(vec![8,0,0,0,8]);
let mut canvas1 = Canvas::new(30,30,PixelColors::Black).unwrap();
let mut screen1 = Screen::new(35,35,PixelColors::Black).unwrap();
canvas1.attach(&shape5,8,8).unwrap();
canvas1.attach(&shape2,10,10).unwrap();
canvas1.attach(&shape2,13,10).unwrap();
canvas1.attach(&shape4,12,13).unwrap();
canvas1.attach(&vecer,10,14).unwrap();
canvas1.attach(&shape3,10,15).unwrap();
canvas1.attach(&shape6,16,16).unwrap();
screen1.attach(&canvas1);
//simply print it once:
screen1.print_screen();
//or present it by animation:
let vecan = vec![screen1];
use termi_graphics::animation::Animation;
let anim = Animation::new(vecan,15,3);
}