From 681185cf8fa9639e631c4c289d308697b44e55bd Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Sat, 18 Dec 2021 12:22:46 -0600 Subject: [PATCH] Basic data structures --- src/game.rs | 34 ++++++++++++++++++++++++++++++++++ src/main.rs | 10 +++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/game.rs diff --git a/src/game.rs b/src/game.rs new file mode 100644 index 0000000..a3626af --- /dev/null +++ b/src/game.rs @@ -0,0 +1,34 @@ +use pancurses::Window; + +pub struct Dungeon { + main_branch: DungeonBranch, +} + +pub struct DungeonBranch { + config: BranchConfig, + levels: Vec, +} + +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!() + } +} diff --git a/src/main.rs b/src/main.rs index 2388d9d..6dda9ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(); }