asteroids-genetic/src/main.rs

30 lines
590 B
Rust
Raw Normal View History

2022-10-08 13:15:07 +00:00
mod asteroids;
mod player;
2022-10-08 15:27:05 +00:00
mod utils;
mod world;
2022-10-08 13:15:07 +00:00
use asteroids::Asteroid;
use macroquad::prelude::*;
use player::Player;
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-08 15:27:05 +00:00
let mut world = World::new();
2022-10-08 13:15:07 +00:00
loop {
clear_background(BLACK);
2022-10-09 05:40:56 +00:00
if !world.over {
world.update();
}
2022-10-08 15:27:05 +00:00
world.draw();
2022-10-08 13:15:07 +00:00
next_frame().await
}
}