this repo has no description
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

🚸 Specify dimensions for Canvas::new, replace old ::new with ::with_layers

+15 -9
+1 -1
examples/schedule-hell-backbone/src/main.rs
··· 6 6 7 7 fn main() { 8 8 env_logger::init(); 9 - let mut canvas = Canvas::new(vec![ 9 + let mut canvas = Canvas::with_layers(vec![ 10 10 "flickers_occlusions", 11 11 "flickers", 12 12 "occlusions",
+1 -1
examples/schedule-hell/src/main.rs
··· 23 23 24 24 #[tokio::main] 25 25 pub async fn main() -> Result<()> { 26 - let mut canvas = Canvas::new(vec![]); 26 + let mut canvas = Canvas::with_layers(vec![]); 27 27 28 28 canvas.set_grid_size(16, 9); 29 29 canvas.colormap = ColorMapping {
+3 -3
examples/specimen/src/main.rs
··· 1 1 use shapemaker::*; 2 2 3 3 pub fn shapes_shed() -> Canvas { 4 - let mut canvas = Canvas::new(vec![]); 4 + let mut canvas = Canvas::with_layers(vec![]); 5 5 6 6 canvas.set_grid_size(3, 3); 7 7 canvas.set_background(Color::White); ··· 29 29 } 30 30 31 31 pub fn colors_shed() -> Canvas { 32 - let mut canvas = Canvas::new(vec!["circles"]); 32 + let mut canvas = Canvas::with_layers(vec!["circles"]); 33 33 canvas.set_grid_size(3, 3); 34 34 canvas.canvas_outter_padding = 0; 35 35 canvas.set_background(Color::White); ··· 56 56 } 57 57 58 58 pub fn grid() -> Canvas { 59 - let mut canvas = Canvas::new(vec![]); 59 + let mut canvas = Canvas::with_layers(vec![]); 60 60 canvas.set_grid_size(3, 3); 61 61 canvas.set_background(Color::White); 62 62
+1 -1
src/cli/mod.rs
··· 83 83 84 84 pub fn canvas_from_cli(args: &Args) -> Canvas { 85 85 debug_time!("canvas_from_cli"); 86 - let mut canvas = Canvas::new(vec![]); 86 + let mut canvas = Canvas::with_layers(vec![]); 87 87 canvas.colormap = load_colormap(args); 88 88 set_canvas_settings_from_args(args, &mut canvas); 89 89 canvas
+1 -1
src/cli/new.rs
··· 111 111 use rand; 112 112 113 113 pub fn main() {{ 114 - let mut canvas = Canvas::new(vec![]); 114 + let mut canvas = Canvas::with_layers(vec![]); 115 115 116 116 // Make your canvas beautiful <3 117 117
+7 -1
src/graphics/canvas.rs
··· 34 34 } 35 35 36 36 impl Canvas { 37 + pub fn new(width: usize, height: usize) -> Self { 38 + let mut canvas = Self::with_layers(vec![]); 39 + canvas.set_grid_size(width, height); 40 + canvas 41 + } 42 + 37 43 pub fn default_settings() -> Self { 38 44 Self { 39 45 grid_size: (3, 3), ··· 54 60 /// Create a new canvas. 55 61 /// The layers are in order of top to bottom: the first layer will be rendered on top of the second, etc. 56 62 /// A layer named "root" will be added below all layers if you don't add it yourself. 57 - pub fn new(layer_names: Vec<&str>) -> Self { 63 + pub fn with_layers(layer_names: Vec<&str>) -> Self { 58 64 let mut canvas = Self::default_settings(); 59 65 canvas.load_fonts().unwrap(); 60 66 canvas.init_layers(layer_names);
+1 -1
src/video/hooks.rs
··· 86 86 87 87 impl<AdditionalContext: Default> Default for Video<AdditionalContext> { 88 88 fn default() -> Self { 89 - Self::new(Canvas::new(vec!["root"])) 89 + Self::new(Canvas::with_layers(vec!["root"])) 90 90 } 91 91 } 92 92