Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.63 KB | None | 0 0
  1. pub struct Rain<'a>{
  2.  pub blobs: Vec<Blob>,
  3.  ctx: &'a Context
  4. }
  5.  
  6. impl Rain<'_>{
  7.  fn new(ctx: &mut Context, maxCount: isize)->Rain{
  8.    Rain {
  9.      blobs: (1..maxCount).map(|_x| Blob::new()).collect::<Vec<Blob>>(),
  10.      ctx
  11.    }
  12.  }
  13.  
  14.  fn draw(&mut self){
  15.    for blob in &self.blobs {
  16.      let circle = graphics::Mesh::new_circle(
  17.        self.ctx,
  18.        graphics::DrawMode::fill(),
  19.        na::Point2::new(blob.position.x, blob.position.y),
  20.        blob.radius,
  21.        0.1,
  22.        graphics::WHITE,
  23.      );
  24.      // graphics::draw(ctx, &circle, (na::Point2::new(pool.position.x, pool.position.y),))?;
  25.    }
  26.  }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement