bevy/crates/bevy_winit/src
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
..
accessibility.rs Move accessibility setup to accessibility module (#12784) 2024-03-29 16:02:25 +00:00
converters.rs Add logical key data to KeyboardInput (#11400) 2024-01-22 15:25:17 +00:00
lib.rs Deprecate ReceivedCharacter (#12868) 2024-04-30 00:49:41 +00:00
system.rs Fix Clippy lints on WASM (#13030) 2024-04-20 09:15:42 +00:00
winit_config.rs Remove unecessary lint #[allow(...)] (#12983) 2024-04-22 16:45:29 +00:00
winit_event.rs Deprecate ReceivedCharacter (#12868) 2024-04-30 00:49:41 +00:00
winit_windows.rs Fix Clippy lints on WASM (#13030) 2024-04-20 09:15:42 +00:00