Reflect derived traits on all components and resources: bevy_input (#15220)
Solves https://github.com/bevyengine/bevy/issues/15187 for bevy_input
This commit is contained in:
parent
569f68f8a0
commit
e718bbd55c
@ -1,5 +1,7 @@
|
|||||||
//! The generic input type.
|
//! The generic input type.
|
||||||
|
|
||||||
|
#[cfg(feature = "bevy_reflect")]
|
||||||
|
use bevy_ecs::reflect::ReflectResource;
|
||||||
use bevy_ecs::system::Resource;
|
use bevy_ecs::system::Resource;
|
||||||
#[cfg(feature = "bevy_reflect")]
|
#[cfg(feature = "bevy_reflect")]
|
||||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
@ -154,7 +156,7 @@ use std::hash::Hash;
|
|||||||
///[`ResMut`]: bevy_ecs::system::ResMut
|
///[`ResMut`]: bevy_ecs::system::ResMut
|
||||||
///[`DetectChangesMut::bypass_change_detection`]: bevy_ecs::change_detection::DetectChangesMut::bypass_change_detection
|
///[`DetectChangesMut::bypass_change_detection`]: bevy_ecs::change_detection::DetectChangesMut::bypass_change_detection
|
||||||
#[derive(Debug, Clone, Resource)]
|
#[derive(Debug, Clone, Resource)]
|
||||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))]
|
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default, Resource))]
|
||||||
pub struct ButtonInput<T: Copy + Eq + Hash + Send + Sync + 'static> {
|
pub struct ButtonInput<T: Copy + Eq + Hash + Send + Sync + 'static> {
|
||||||
/// A collection of every button that is currently being pressed.
|
/// A collection of every button that is currently being pressed.
|
||||||
pressed: HashSet<T>,
|
pressed: HashSet<T>,
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use crate::{Axis, ButtonInput, ButtonState};
|
use crate::{Axis, ButtonInput, ButtonState};
|
||||||
use bevy_ecs::event::{Event, EventReader, EventWriter};
|
use bevy_ecs::event::{Event, EventReader, EventWriter};
|
||||||
|
#[cfg(feature = "bevy_reflect")]
|
||||||
|
use bevy_ecs::reflect::ReflectResource;
|
||||||
use bevy_ecs::{
|
use bevy_ecs::{
|
||||||
change_detection::DetectChangesMut,
|
change_detection::DetectChangesMut,
|
||||||
system::{Res, ResMut, Resource},
|
system::{Res, ResMut, Resource},
|
||||||
@ -384,7 +386,11 @@ impl GamepadAxis {
|
|||||||
/// should register as a [`GamepadEvent`]. Events that don't meet the change thresholds defined in [`GamepadSettings`]
|
/// should register as a [`GamepadEvent`]. Events that don't meet the change thresholds defined in [`GamepadSettings`]
|
||||||
/// will not register. To modify these settings, mutate the corresponding resource.
|
/// will not register. To modify these settings, mutate the corresponding resource.
|
||||||
#[derive(Resource, Default, Debug)]
|
#[derive(Resource, Default, Debug)]
|
||||||
#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))]
|
#[cfg_attr(
|
||||||
|
feature = "bevy_reflect",
|
||||||
|
derive(Reflect),
|
||||||
|
reflect(Debug, Default, Resource)
|
||||||
|
)]
|
||||||
|
|
||||||
pub struct GamepadSettings {
|
pub struct GamepadSettings {
|
||||||
/// The default button settings.
|
/// The default button settings.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user