Basic data structures
This commit is contained in:
parent
960ca03ed1
commit
681185cf8f
34
src/game.rs
Normal file
34
src/game.rs
Normal 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!()
|
||||
}
|
||||
}
|
10
src/main.rs
10
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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue