|
@@ -11,9 +11,16 @@ use player::*;
|
|
|
mod rect;
|
|
|
pub use rect::Rect;
|
|
|
|
|
|
+rltk::add_wasm_support!();
|
|
|
+
|
|
|
pub struct State {
|
|
|
- pub ecs: World,
|
|
|
- pub systems: Dispatcher<'static, 'static>
|
|
|
+ pub ecs: World
|
|
|
+}
|
|
|
+
|
|
|
+impl State {
|
|
|
+ fn run_systems(&mut self) {
|
|
|
+ self.ecs.maintain();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
impl GameState for State {
|
|
@@ -21,7 +28,7 @@ impl GameState for State {
|
|
|
ctx.cls();
|
|
|
|
|
|
player_input(self, ctx);
|
|
|
- self.systems.dispatch(&self.ecs);
|
|
|
+ self.run_systems();
|
|
|
|
|
|
let map = self.ecs.fetch::<Vec<TileType>>();
|
|
|
draw_map(&map, ctx);
|
|
@@ -36,11 +43,9 @@ impl GameState for State {
|
|
|
}
|
|
|
|
|
|
fn main() {
|
|
|
- let context = Rltk::init_simple8x8(80, 50, "Hello Rust World", "../resources");
|
|
|
+ let context = Rltk::init_simple8x8(80, 50, "Hello Rust World", "resources");
|
|
|
let mut gs = State {
|
|
|
- ecs: World::new(),
|
|
|
- systems : DispatcherBuilder::new()
|
|
|
- .build()
|
|
|
+ ecs: World::new()
|
|
|
};
|
|
|
gs.ecs.register::<Position>();
|
|
|
gs.ecs.register::<Renderable>();
|