bevy/examples/input
Antony 7b4b5966d9
Deprecate ReceivedCharacter (#12868)
# Objective

- Partially resolves #12639.

## Solution

- Deprecate `ReceivedCharacter`.
- Replace `ReceivedCharacter` with `KeyboardInput` in the relevant
examples.

## Migration Guide

- `ReceivedCharacter` is now deprecated, use `KeyboardInput` instead.

- Before:
  ```rust
  fn listen_characters(events: EventReader<ReceivedCharacter>) {
    for event in events.read() {
      info!("{}", event.char);
    }
  }
  ```
  
  After:
  ```rust
  fn listen_characters(events: EventReader<KeyboardInput>) {
    for event in events.read() {
      // Only check for characters when the key is pressed.
      if event.state == ButtonState::Released {
        continue;
      }
// Note that some keys such as `Space` and `Tab` won't be detected as
before.
      // Instead, check for them with `Key::Space` and `Key::Tab`.
      if let Key::Character(character) = &event.logical_key {
        info!("{}", character);
      }
    }
  }
  ```

---------

Co-authored-by: Mike <mike.hsu@gmail.com>
2024-04-30 00:49:41 +00:00
..
char_input_events.rs Deprecate ReceivedCharacter (#12868) 2024-04-30 00:49:41 +00:00
gamepad_input.rs Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
gamepad_input_events.rs Fix typos (#9965) 2023-09-29 12:26:41 +00:00
gamepad_rumble.rs Rename Input to ButtonInput (#10859) 2023-12-06 20:32:34 +00:00
keyboard_input.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
keyboard_input_events.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
keyboard_modifiers.rs Update winit dependency to 0.29 (#10702) 2023-12-21 07:40:47 +00:00
mouse_grab.rs Rename Input to ButtonInput (#10859) 2023-12-06 20:32:34 +00:00
mouse_input.rs Rename Input to ButtonInput (#10859) 2023-12-06 20:32:34 +00:00
mouse_input_events.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
text_input.rs Deprecate ReceivedCharacter (#12868) 2024-04-30 00:49:41 +00:00
touch_input.rs Non-breaking change* from UK spellings to US (#8291) 2023-04-08 16:22:46 +00:00
touch_input_events.rs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00