observable_keyboard
The KeyboardObservable turns Bevy keyboard input events into signals. The
events are sourced from the ButtonInput<KeyCode> resource.
Options
KeyCode signals can be observed in multiple modes:
KeyboardObservableEmit::JustPressed- emits once when the key is pressed down.KeyboardObservableEmit::JustReleased- emits once when the key is released.KeyboardObservableEmit::WhilePressed- emits continuously while the key is held down.
See Also
- EventObservable - Observe events sent to an entity.
- MessageObservable -
Observe messages written via
MessageWriter. - ProxyObservable - Subscribe to another observable entity.
- ResourceObservable - Observe derived values of a resource on change.
Example
Output when pressing WASD keys and Space:
keyboard - next: KeyW
keyboard - next: KeyA
keyboard - next: KeyS
keyboard - next: KeyD
keyboard - next: Space
keyboard - unsubscribed