diff --git a/src/main.rs b/src/main.rs index 6ebe17d..45822b1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -153,6 +153,7 @@ fn get_next_frame( line = transformer.apply(&line, world_state); } + info!("Draw Black -> {}", world_state.draw_black); info!("Draw Grid -> {}", world_state.draw_grid); diff --git a/src/transformer/replicate.rs b/src/transformer/replicate.rs index 590b82f..d063b49 100644 --- a/src/transformer/replicate.rs +++ b/src/transformer/replicate.rs @@ -1,4 +1,4 @@ -use crate::point::Point; +use crate::point::{Point, Color}; use crate::transformer::Transformers; use crate::worldstate::WorldState; @@ -16,10 +16,15 @@ pub enum Replicate { impl Transformers for Replicate { fn apply(&self, point_list: &[Point], _ws: &WorldState) -> Vec { let mut point_list2 = vec![]; + match self { Replicate::Until(n) => { while point_list2.len() < *n { - point_list2.append(&mut point_list.to_vec()); + if point_list.len() == 0 { // to prevent infinit loop in case of empty frame + point_list2.append(&mut vec![Point{x:0., y:0., color: Color{r:0, g:0, b:0}}; *n].to_vec()); + } else { + point_list2.append(&mut point_list.to_vec()); + } } } Replicate::Times(n) => {