Skip to content

Commit

Permalink
update: add KeySequence creation patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
not-elm committed Apr 22, 2024
1 parent 085d1d6 commit 31a8954
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@ differently than a regular runnable example:

The next section describes the runnable examples that come with the crate.

## KeySequence creation patterns

### Create a KeySequence entity and component.

```rust

commands.add(KeySequence::new(…));
```

### Create a KeySequence component and add it to an entity.

```rust
commands.entity(id).add(KeySequence::new(…));
// OR
commands.spawn(…)
.add(KeySequence::new(…));
```

### Create a KeySequence component but don't add it to anything

```rust
commands.add(|&mut world| {
let builder = KeySequence::new(…);
let key_sequence = builder.build(world);
// And then put it somewhere?
});
```

## Run a System on a Key Sequence

Runs a system whenever the user presses the key sequence `H I` or "hi" within a
Expand Down

0 comments on commit 31a8954

Please sign in to comment.