bevy/crates/bevy_input/src
Jakob Hellermann 7d9e864d9c implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676)
# Objective

- I'm currently working on being able to call methods on reflect types (https://github.com/jakobhellermann/bevy_reflect_fns)
- for that, I'd like to add methods to the `Input<KeyCode>` resource (which I'm doing by registering type data)
- implementing `Reflect` is currently a requirement for having type data in the `TypeRegistry`

## Solution

- derive `Reflect` for `KeyCode` and `Input`
- uses `#[reflect_value]` for `Input`, since it's fields aren't supposed to be observable
- using reflect_value would need `Clone` bounds on `T`, but since all the methods (`.pressed` etc) already require `T: Copy`, I unified everything to requiring `Copy`
- add `Send + Sync + 'static` bounds, also required by reflect derive

## Unrelated improvements 
I can extract into a separate PR if needed.

- the `Reflect` derive would previously ignore `#[reflect_value]` and only accept `#[reflect_value()]` which was a bit confusing
- the generated code used `val.clone()` on a reference, which is fine if `val` impls `Clone`, but otherwise also compiles with a worse error message. Change to `std::clone::Clone::clone(val)` instead which gives a neat `T does not implement Clone` error
2022-09-07 15:59:50 +00:00
..
axis.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
gamepad.rs Gamepad type is Copy; do not require / return references to it in Gamepads API (#5296) 2022-09-03 20:08:54 +00:00
input.rs implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676) 2022-09-07 15:59:50 +00:00
keyboard.rs implement Reflect for Input<T>, some misc improvements to reflect value derive (#5676) 2022-09-07 15:59:50 +00:00
lib.rs Added keyboard scan input event (#5495) 2022-08-05 04:19:53 +00:00
mouse.rs Update MouseMotion and CursorMoved docs (#5090) 2022-06-26 13:40:43 +00:00
touch.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00