diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index 58db560f6d..23f07807cd 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -102,6 +102,10 @@ pub struct KeyboardInput { pub logical_key: Key, /// The press state of the key. pub state: ButtonState, + /// On some systems, holding down a key for some period of time causes that key to be repeated + /// as though it were being pressed and released repeatedly. This field is [`true`] if this + /// event is the result of one of those repeats. + pub repeat: bool, /// Window that received the input. pub window: Entity, } diff --git a/crates/bevy_winit/src/converters.rs b/crates/bevy_winit/src/converters.rs index 5cc2c03475..a6358433c3 100644 --- a/crates/bevy_winit/src/converters.rs +++ b/crates/bevy_winit/src/converters.rs @@ -17,6 +17,7 @@ pub fn convert_keyboard_input( state: convert_element_state(keyboard_input.state), key_code: convert_physical_key_code(keyboard_input.physical_key), logical_key: convert_logical_key(&keyboard_input.logical_key), + repeat: keyboard_input.repeat, window, } }