From efac8fadf02ccb6a46acb1d899caaa9b84896712 Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Sat, 18 Dec 2021 12:29:07 -0600 Subject: [PATCH] Doc comments --- src/game.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/game.rs b/src/game.rs index a3626af..178863d 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1,22 +1,34 @@ use pancurses::Window; +/// A dungeon root. pub struct Dungeon { main_branch: DungeonBranch, } +/// A single branch of a dungeon, which has a number of levels and +/// which can potentially contain passages to other branches. pub struct DungeonBranch { config: BranchConfig, levels: Vec, } +/// The parameters that characterize a particular dungeon branch. +/// Currently a unit struct because there's only one type of branch, +/// but will later include e.g. architectural styles, good vs. evil & +/// lawful vs. chaotic weights, etc. pub struct BranchConfig; +/// The size of a dungeon level, in tiles. pub const LEVEL_SIZE: (usize, usize) = (80, 24); +/// A single level of the dungeon. pub struct DungeonLevel { + /// The tiles at every position in the level. tiles: [[DungeonTile; LEVEL_SIZE.1]; LEVEL_SIZE.0], } +/// The smallest possible independent location in the dungeon, +/// corresponding to a single character on the screen. pub enum DungeonTile { Floor, Wall, @@ -24,10 +36,13 @@ pub enum DungeonTile { } impl DungeonLevel { + /// Creates a new level in a branch that has the given + /// configuration. pub fn new(cfg: &BranchConfig) -> Self { todo!() } + /// Draws a level on the display window. pub fn draw(&self, win: &Window) { todo!() }