···111111use rand;
112112113113pub fn main() {{
114114- let mut canvas = Canvas::new(vec![]);
114114+ let mut canvas = Canvas::with_layers(vec![]);
115115116116 // Make your canvas beautiful <3
117117
+7-1
src/graphics/canvas.rs
···3434}
35353636impl Canvas {
3737+ pub fn new(width: usize, height: usize) -> Self {
3838+ let mut canvas = Self::with_layers(vec![]);
3939+ canvas.set_grid_size(width, height);
4040+ canvas
4141+ }
4242+3743 pub fn default_settings() -> Self {
3844 Self {
3945 grid_size: (3, 3),
···5460 /// Create a new canvas.
5561 /// The layers are in order of top to bottom: the first layer will be rendered on top of the second, etc.
5662 /// A layer named "root" will be added below all layers if you don't add it yourself.
5757- pub fn new(layer_names: Vec<&str>) -> Self {
6363+ pub fn with_layers(layer_names: Vec<&str>) -> Self {
5864 let mut canvas = Self::default_settings();
5965 canvas.load_fonts().unwrap();
6066 canvas.init_layers(layer_names);