1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! This crate is a rust lib for making [braille] art.
//!
//! You can use the basic canvas to paint something,
//! or you can use Turtle to paint things like in python.
//! And there are more useful things like colorful output, 3D object, life game and so on!
//!
//! ## Examples
//!
//! draw the sin(x)
//! ```
//! use rsille::Canvas;
//! let mut c = Canvas::new();
//! for x in 0..1800 {
//! let x = x as f64;
//! c.set(x / 10.0, 15.0 + x.to_radians().sin() * 10.0);
//! }
//! c.print();
//! ```
//!
//! draw a star
//! ```
//! use rsille::{extra::Turtle, Canvas};
//! let mut c = Canvas::new();
//! let mut t = Turtle::new();
//! for _ in 0..5 {
//! t.forward(30.0);
//! t.right(144.0);
//! }
//! c.paint(&t, 0.0, 15.0).unwrap();
//! c.print();
//! ```
//!
//! life game
//! ```no_run
//! use rsille::{extra::LifeGame, Animation};
//! let lg = LifeGame::from_path("path/to/rle").unwrap();
//! let mut anime = Animation::new();
//! anime.push(lg, |lg| lg.update(), (0.0, 0.0));
//! anime.run();
//! ```
//!
//! Want more examples? check the [examples](https://github.com/nidhoggfgg/rsille/tree/main/examples)
//!
//! ## Extra
//!
//! Useful things can paint on canvas:
//! 1. [`Object3d`](extra/struct.Object3D.html) the 3d object
//! 2. [`Turtle`](extra/struct.Turtle.html) similar to the turtle in python
//! 3. [`Imagille`](extra/struct.Imgille.html) paint image to braille code
//! 4. [`Lifegame`](extra/struct.LifeGame.html) the life game in braille code
//!
//! ## NOTE
//!
//! About (x, y), you can simply put on (0.0, 0.0) for one object, it will find the right position to paint.
//! But if you want to build a animation or paint multiple objects,
//! you may should find the right position by yourself.
//!
//! For example, this is a dot:
//! ```text
//! $ ./path/to/file # your terminal
//! +--------+--------> x
//! |
//! |
//! + ⣿
//! |
//! |
//! v y
//! ```
//! This dot in terminal is (10, 4), because the left top corner is (1, 1).
//! The y-axis is also facing down.
//! It's different from the math coordinate system.
//!
//! But in the canvas, it's use the math coordinate system, and include the braille.
//! Like a braille code "⣿", it has 2x4 dots, and it be thought as 8 dots not 1 dots.
//! In the canvas, this dots B is `x` from 18.0 to 19.0, `y` from 8.0 to 11.0.
//! And the dot A (the left top) is on (4.0, 11.0).
//! ```text
//! ^ y
//! |
//! | A B
//! + ⠁ ⣿
//! |
//! |
//! +--------+--------> x
//! 0.0
//! ```
//!
//! If you really don't know how to find the right position.
//! Just try to paint your things at anyway and try to move it to another place and try again. :)
//! And try to set x > 0 and y < 0, then the object will always in the screen and won't move.
//!
//! ## Other
//!
//! It's inspired by [drawille], but it has more features and fast
//!
//! [braille]: http://www.alanwood.net/unicode/braille_patterns.html
//! [drawille]: https://github.com/asciimoo/drawille
pub use Animation;
pub use Canvas;
pub use Paint;
pub use Decor;
pub use RsilleErr;