Struct bevy::input::gamepad::GamepadEvent
pub struct GamepadEvent {
pub gamepad: Gamepad,
pub event_type: GamepadEventType,
}
Expand description
An event of a Gamepad
.
This event is the translated version of the GamepadEventRaw
. It is available to
the end user and can be used for game logic.
Differences
The difference between the GamepadEventRaw
and the GamepadEvent
is that the
former respects user defined GamepadSettings
for the gamepad inputs when translating it
to the latter. The former also updates the Input<GamepadButton>
, Axis<GamepadAxis>
,
and Axis<GamepadButton>
resources accordingly.
Gamepad input mocking
When mocking gamepad input, use GamepadEventRaw
s instead of GamepadEvent
s.
Otherwise GamepadSettings
won’t be respected and the Input<GamepadButton>
,
Axis<GamepadAxis>
, and Axis<GamepadButton>
resources won’t be updated correctly.
An example for gamepad input mocking can be seen in the documentation of the GamepadEventRaw
.
Fields
gamepad: Gamepad
The gamepad this event corresponds to.
event_type: GamepadEventType
The type of the event.
Implementations
impl GamepadEvent
impl GamepadEvent
pub fn new(gamepad: Gamepad, event_type: GamepadEventType) -> GamepadEvent
pub fn new(gamepad: Gamepad, event_type: GamepadEventType) -> GamepadEvent
Creates a new GamepadEvent
.
Trait Implementations
impl Clone for GamepadEvent
impl Clone for GamepadEvent
fn clone(&self) -> GamepadEvent
fn clone(&self) -> GamepadEvent
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl Debug for GamepadEvent
impl Debug for GamepadEvent
impl FromReflect for GamepadEventwhere
Gamepad: FromReflect,
GamepadEventType: FromReflect,
impl FromReflect for GamepadEventwhere
Gamepad: FromReflect,
GamepadEventType: FromReflect,
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<GamepadEvent>
fn from_reflect(reflect: &(dyn Reflect + 'static)) -> Option<GamepadEvent>
Self
from a reflected value.impl GetTypeRegistration for GamepadEvent
impl GetTypeRegistration for GamepadEvent
impl PartialEq<GamepadEvent> for GamepadEvent
impl PartialEq<GamepadEvent> for GamepadEvent
fn eq(&self, other: &GamepadEvent) -> bool
fn eq(&self, other: &GamepadEvent) -> bool
impl Reflect for GamepadEvent
impl Reflect for GamepadEvent
fn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
fn into_any(self: Box<GamepadEvent, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<GamepadEvent, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Any>
.fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.fn into_reflect(
self: Box<GamepadEvent, Global>
) -> Box<dyn Reflect + 'static, Global>
fn into_reflect(
self: Box<GamepadEvent, Global>
) -> Box<dyn Reflect + 'static, Global>
fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
Reflect
trait object. Read morefn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn set(
&mut self,
value: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_owned(self: Box<GamepadEvent, Global>) -> ReflectOwned
fn reflect_owned(self: Box<GamepadEvent, Global>) -> ReflectOwned
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
impl Struct for GamepadEvent
impl Struct for GamepadEvent
fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
fn field_at_mut(&mut self, index: usize) -> Option<&mut (dyn Reflect + 'static)>
index
as a &mut dyn Reflect
. Read morefn iter_fields(&self) -> FieldIter<'_>ⓘ
fn iter_fields(&self) -> FieldIter<'_>ⓘ
fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct
.impl Typed for GamepadEvent
impl Typed for GamepadEvent
impl StructuralPartialEq for GamepadEvent
Auto Trait Implementations
impl RefUnwindSafe for GamepadEvent
impl Send for GamepadEvent
impl Sync for GamepadEvent
impl Unpin for GamepadEvent
impl UnwindSafe for GamepadEvent
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist. Read moresourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read morefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read morefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read morefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read moreimpl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
impl<T> GetPath for Twhere
T: Reflect,
impl<T> GetPath for Twhere
T: Reflect,
fn path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read morefn path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read morefn get_path<T, 'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>>where
T: Reflect,
fn get_path<T, 'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r T, ReflectPathError<'p>>where
T: Reflect,
path
.fn get_path_mut<T, 'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>>where
T: Reflect,
fn get_path_mut<T, 'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read more