dungeon-game/src/main.rs

37 lines
689 B
Rust
Raw Normal View History

2022-01-02 13:17:17 -06:00
use components::{register_all, CharRender, Position};
2021-12-18 12:22:46 -06:00
use game::{BranchConfig, DungeonLevel};
2021-12-18 12:06:50 -06:00
2022-01-02 12:56:42 -06:00
use specs::prelude::*;
use systems::IOSystem;
mod components;
2021-12-18 12:22:46 -06:00
mod game;
mod rooms;
2022-01-02 12:56:42 -06:00
mod systems;
mod util;
2021-12-18 12:22:46 -06:00
2021-12-18 11:58:33 -06:00
fn main() {
2022-01-02 12:56:42 -06:00
let mut world = World::new();
register_all(&mut world);
2021-12-18 12:22:46 -06:00
let cfg = BranchConfig;
let level = DungeonLevel::new(&cfg);
2022-01-02 12:56:42 -06:00
world.insert(level);
world
.create_entity()
.with(Position { x: 5, y: 6 })
.with(CharRender { glyph: '@' })
.build();
let mut dispatcher = DispatcherBuilder::new()
.with(IOSystem::new(), "render_system", &[])
.build();
2021-12-18 12:22:46 -06:00
2022-01-02 12:56:42 -06:00
loop {
2022-01-02 13:17:17 -06:00
dispatcher.dispatch(&world);
2022-01-02 12:56:42 -06:00
}
2021-12-18 11:58:33 -06:00
}