asteroids-genetic/src/main.rs

49 lines
1.1 KiB
Rust
Raw Normal View History

2022-10-08 13:15:07 +00:00
mod asteroids;
2022-10-09 18:14:22 +00:00
mod nn;
2022-10-08 13:15:07 +00:00
mod player;
2022-10-09 20:11:24 +00:00
mod population;
2022-10-08 15:27:05 +00:00
mod world;
2022-10-08 13:15:07 +00:00
use macroquad::prelude::*;
2022-10-10 18:36:14 +00:00
use population::Population;
2022-10-08 15:27:05 +00:00
use world::World;
2022-10-08 13:15:07 +00:00
#[macroquad::main("Camera")]
async fn main() {
rand::srand(macroquad::miniquad::date::now() as _);
let cam = Camera2D {
2022-10-09 05:40:56 +00:00
zoom: vec2(2. / screen_width(), -2. / screen_height()),
2022-10-08 13:15:07 +00:00
..Default::default()
};
set_camera(&cam);
2022-10-14 10:57:58 +00:00
let mut pop = Population::new(10);
2022-10-10 19:43:05 +00:00
let mut speedup = false;
2022-10-14 10:57:58 +00:00
// for _ in 0..100000 * 5 {
// pop.update();
// }
2022-10-08 13:15:07 +00:00
loop {
2022-10-10 10:13:06 +00:00
clear_background(BLACK);
2022-10-10 19:43:05 +00:00
if is_key_pressed(KeyCode::S) {
speedup = !speedup;
}
if speedup {
for _ in 0..100 {
pop.update();
}
} else {
pop.update();
pop.draw();
}
2022-10-08 13:15:07 +00:00
next_frame().await
}
2022-10-10 18:36:14 +00:00
// let mut world = World::new();
// loop {
// clear_background(BLACK);
// if !world.over {
// world.update();
// }
// world.draw();
// next_frame().await
// }
2022-10-08 13:15:07 +00:00
}