Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
  28.  
  29.  
  30.  
  31. error[E0308]: mismatched types
  32.  --> src/rain.rs:43:9
  33.   |
  34. 43 |         self.ctx,
  35.   |         ^^^^^^^^ types differ in mutability
  36.   |
  37.   = note: expected type `&mut ggez::context::Context`
  38.              found type `&ggez::context::Context
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement