Basic data structures

This commit is contained in:
Alex Bethel 2021-12-18 12:22:46 -06:00
parent 960ca03ed1
commit 681185cf8f
2 changed files with 43 additions and 1 deletions

34
src/game.rs Normal file
View file

@ -0,0 +1,34 @@
use pancurses::Window;
pub struct Dungeon {
main_branch: DungeonBranch,
}
pub struct DungeonBranch {
config: BranchConfig,
levels: Vec<DungeonLevel>,
}
pub struct BranchConfig;
pub const LEVEL_SIZE: (usize, usize) = (80, 24);
pub struct DungeonLevel {
tiles: [[DungeonTile; LEVEL_SIZE.1]; LEVEL_SIZE.0],
}
pub enum DungeonTile {
Floor,
Wall,
Hallway,
}
impl DungeonLevel {
pub fn new(cfg: &BranchConfig) -> Self {
todo!()
}
pub fn draw(&self, win: &Window) {
todo!()
}
}

View file

@ -1,9 +1,17 @@
use game::{BranchConfig, DungeonLevel};
use pancurses::{endwin, initscr};
mod game;
fn main() {
let window = initscr();
window.printw("Hello World!");
let cfg = BranchConfig;
let level = DungeonLevel::new(&cfg);
level.draw(&window);
window.refresh();
window.getch();
endwin();
}