diff --git a/README.md b/README.md index b2f2b5c..8230478 100644 --- a/README.md +++ b/README.md @@ -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