summaryrefslogtreecommitdiff
path: root/game/src/main.rs
blob: df94ea41365fd57f393696e5a0d3557f09422be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use dungeon::*;
use graphics::*;

fn main() -> Result<()> {
	// Load the window
	let mut window = Window::new_default()?;
	// Initial game state
	let mut dungeon = Dungeon::new();

	// Main game loop
	while window.is_open() {
		// TODO update game state

		// Handle keyboard input
		if window.is_key_pressed(KeyCode::KEY_F3) {
			window.toggle_debug();
		}

		for enemy in dungeon.enemies.iter_mut() {
			enemy.handle_movement(
				dungeon.player.entity.pos,
				&dungeon.floor,
				window.delta_time(),
			);
		}

		// Draw a single frame
		window.draw_frame(&dungeon);
	}

	Ok(())
}