kroz-rs/src/state.rs
Alex Page d9606e8b87
All checks were successful
continuous-integration/drone/push Build is passing
Switch from specs to hecs
2022-02-03 00:07:12 -05:00

23 lines
571 B
Rust

use crate::resources::Resources;
use crate::{graphics, input, systems};
use bracket_lib::prelude::*;
use hecs::World;
pub struct State {
world: World,
resources: Resources,
}
impl GameState for State {
fn tick(&mut self, bterm: &mut BTerm) {
input::handle(&mut self.world, &mut self.resources, bterm);
systems::run(&mut self.world, &mut self.resources);
graphics::draw(&self.world, &self.resources, bterm);
}
}
impl State {
pub fn new(world: World, resources: Resources) -> Self {
State { world, resources }
}
}