Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/tutorials/src/02_hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ need to create a world in which to store all of our components.
```rust,ignore
use specs::{World, WorldExt, Builder};

let mut world = World::new();
world.register::<Position>();
world.register::<Velocity>();
fn the_world(){
let mut world = World::new();
world.register::<Position>();
world.register::<Velocity>();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to return the world?

```

This will create component storages for `Position`s and `Velocity`s.
Expand Down Expand Up @@ -173,9 +175,11 @@ them. To execute the system, you can use `RunNow` like this:
```rust,ignore
use specs::RunNow;

let mut hello_world = HelloWorld;
hello_world.run_now(&world);
world.maintain();
fn run_the_system() {
let mut hello_world = HelloWorld;
hello_world.run_now(&world);
world.maintain();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does it get run from, should be passed in by mut reference or so?

}
```

The `world.maintain()` is not completely necessary here. Calling maintain should be done in general, however.
Expand Down