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.
 | 
			
		||||
 | 
			
		||||
#[cfg(feature = "bevy_reflect")]
 | 
			
		||||
use bevy_ecs::reflect::ReflectResource;
 | 
			
		||||
use bevy_ecs::system::Resource;
 | 
			
		||||
#[cfg(feature = "bevy_reflect")]
 | 
			
		||||
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
 | 
			
		||||
@ -154,7 +156,7 @@ use std::hash::Hash;
 | 
			
		||||
///[`ResMut`]: bevy_ecs::system::ResMut
 | 
			
		||||
///[`DetectChangesMut::bypass_change_detection`]: bevy_ecs::change_detection::DetectChangesMut::bypass_change_detection
 | 
			
		||||
#[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> {
 | 
			
		||||
    /// A collection of every button that is currently being pressed.
 | 
			
		||||
    pressed: HashSet<T>,
 | 
			
		||||
 | 
			
		||||
@ -2,6 +2,8 @@
 | 
			
		||||
 | 
			
		||||
use crate::{Axis, ButtonInput, ButtonState};
 | 
			
		||||
use bevy_ecs::event::{Event, EventReader, EventWriter};
 | 
			
		||||
#[cfg(feature = "bevy_reflect")]
 | 
			
		||||
use bevy_ecs::reflect::ReflectResource;
 | 
			
		||||
use bevy_ecs::{
 | 
			
		||||
    change_detection::DetectChangesMut,
 | 
			
		||||
    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`]
 | 
			
		||||
/// will not register. To modify these settings, mutate the corresponding resource.
 | 
			
		||||
#[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 {
 | 
			
		||||
    /// The default button settings.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user