dungeon-game/src/game.rs

50 lines
1.3 KiB
Rust
Raw Normal View History

2021-12-18 12:22:46 -06:00
use pancurses::Window;
2021-12-18 12:29:07 -06:00
/// A dungeon root.
2021-12-18 12:22:46 -06:00
pub struct Dungeon {
main_branch: DungeonBranch,
}
2021-12-18 12:29:07 -06:00
/// A single branch of a dungeon, which has a number of levels and
/// which can potentially contain passages to other branches.
2021-12-18 12:22:46 -06:00
pub struct DungeonBranch {
config: BranchConfig,
levels: Vec<DungeonLevel>,
}
2021-12-18 12:29:07 -06:00
/// 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.
2021-12-18 12:22:46 -06:00
pub struct BranchConfig;
2021-12-18 12:29:07 -06:00
/// The size of a dungeon level, in tiles.
2021-12-18 12:22:46 -06:00
pub const LEVEL_SIZE: (usize, usize) = (80, 24);
2021-12-18 12:29:07 -06:00
/// A single level of the dungeon.
2021-12-18 12:22:46 -06:00
pub struct DungeonLevel {
2021-12-18 12:29:07 -06:00
/// The tiles at every position in the level.
2021-12-18 12:22:46 -06:00
tiles: [[DungeonTile; LEVEL_SIZE.1]; LEVEL_SIZE.0],
}
2021-12-18 12:29:07 -06:00
/// The smallest possible independent location in the dungeon,
/// corresponding to a single character on the screen.
2021-12-18 12:22:46 -06:00
pub enum DungeonTile {
Floor,
Wall,
Hallway,
}
impl DungeonLevel {
2021-12-18 12:29:07 -06:00
/// Creates a new level in a branch that has the given
/// configuration.
2021-12-18 12:22:46 -06:00
pub fn new(cfg: &BranchConfig) -> Self {
todo!()
}
2021-12-18 12:29:07 -06:00
/// Draws a level on the display window.
2021-12-18 12:22:46 -06:00
pub fn draw(&self, win: &Window) {
todo!()
}
}