random pos?
This commit is contained in:
parent
c113fdaf92
commit
da25ffb0bf
1 changed files with 10 additions and 3 deletions
13
src/main.rs
13
src/main.rs
|
@ -21,10 +21,17 @@ fn model(app: &App) -> Model {
|
|||
.build()
|
||||
.unwrap();
|
||||
|
||||
Model {
|
||||
_window,
|
||||
particles: Vec::new(),
|
||||
let boundary = app.window_rect();
|
||||
let mut particles = Vec::new();
|
||||
|
||||
for _ in 0..100 {
|
||||
let x = random_range(boundary.left(), boundary.right());
|
||||
let y = random_range(boundary.top(), boundary.bottom());
|
||||
let particle = Particle::new(Vec2::new(x, y));
|
||||
particles.push(particle);
|
||||
}
|
||||
|
||||
Model { _window, particles }
|
||||
}
|
||||
|
||||
// Handle events related to the window and update the model if necessary
|
||||
|
|
Loading…
Reference in a new issue