2024-07-06 17:59:56 +00:00
|
|
|
mod grid;
|
|
|
|
mod player;
|
|
|
|
|
|
|
|
use grid::Grid;
|
|
|
|
use player::Player;
|
|
|
|
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct HouseState {
|
|
|
|
grid: Grid,
|
|
|
|
player: Player
|
|
|
|
}
|
|
|
|
|
2024-07-06 20:23:25 +00:00
|
|
|
pub fn draw(state: &crate::State, _engine: &comfy::EngineContext<'_>) {
|
2024-07-07 11:21:08 +00:00
|
|
|
if let Some(house) = state.house() {
|
|
|
|
//Draw Grid
|
|
|
|
house.grid.draw();
|
2024-07-06 17:59:56 +00:00
|
|
|
|
2024-07-07 11:21:08 +00:00
|
|
|
//Draw Player
|
|
|
|
house.player.draw();
|
|
|
|
}
|
2024-07-06 17:59:56 +00:00
|
|
|
}
|
|
|
|
|
2024-07-06 20:23:25 +00:00
|
|
|
pub fn update(state: &mut crate::State, _engine: &mut comfy::EngineContext<'_>) {
|
2024-07-07 11:21:08 +00:00
|
|
|
let house = state.house_mut();
|
|
|
|
house.player.update(&house.grid);
|
2024-07-06 17:59:56 +00:00
|
|
|
}
|