// Dev mode: scaffolding is landing incrementally, so don't warn on not-yet-wired items.
#![allow(dead_code)]
use std::process::exit;
use macroquad::prelude::*;
use crate::{
systems::{apply_action, weapons_crate},
world::{PlayerStatus, Screen, World},
};
mod animations;
mod behavior;
mod command;
mod context;
mod enemies;
mod enemy;
mod geometry;
mod pool;
mod pools;
mod registry;
mod rng;
mod spatial;
mod systems;
mod tower;
mod types;
mod weapons;
mod world;
fn window_conf() -> Conf {
Conf {
window_title: "Tower Defense".to_owned(),
window_width: 900,
window_height: 900,
window_resizable: false,
..Default::default()
}
}
#[macroquad::main(window_conf)]
async fn main() {
let mut world = World::new();
loop {
let dt = get_frame_time().min(0.05);
let time = get_time();
systems::step_world(&mut world, dt);
systems::draw_simulation(&world);
let action = match world.state {
Screen::WeaponCrate(_) => weapons_crate(&mut world, time, dt),
_ => None,
};
if action.is_none() && is_key_pressed(KeyCode::Space) {
world.open_weapon_crate();
}
if let Some(action) = action {
apply_action(&mut world, action);
}
if is_key_pressed(KeyCode::Q) {
exit(1)
}
next_frame().await;
}
}