pub fn keyboard_input_system(
keycode_input: ResMut<'_, ButtonInput<KeyCode>>,
key_input: ResMut<'_, ButtonInput<Key>>,
keyboard_input_reader: MessageReader<'_, '_, KeyboardInput>,
keyboard_focus_lost_reader: MessageReader<'_, '_, KeyboardFocusLost>,
)
Expand description
Updates the ButtonInput<KeyCode>
and ButtonInput<Key>
resources with the latest KeyboardInput
events.
ยงDifferences
The main difference between the KeyboardInput
event and the ButtonInput
resources are that
the latter has convenient functions such as ButtonInput::pressed
, ButtonInput::just_pressed
and ButtonInput::just_released
and is window id agnostic.
There is a ButtonInput
for both KeyCode
and Key
as they are both useful in different situations, see their documentation for the details.