Struct bevy_mod_picking::event_listening::OnPointer
source · pub struct OnPointer<E>where
E: IsPointerEvent,{ /* private fields */ }
Expand description
Used to attach a callback to an entity. This callback is executed any time a pointer event triggers this listener when bubbling up the entity hierarchy.
Callback systems will give you access to the ListenedEvent
that triggered the event listener.
This includes the listener
which is the entity with the OnPointer
component, and the
target
which is the entity that generated the event. The target
can be this entity or any of
its children.
Implementations§
source§impl<E> OnPointer<E>where
E: IsPointerEvent,
impl<E> OnPointer<E>where E: IsPointerEvent,
sourcepub fn run_callback<M>(
callback: impl IntoSystem<ListenedEvent<E>, Bubble, M>
) -> OnPointer<E>
pub fn run_callback<M>( callback: impl IntoSystem<ListenedEvent<E>, Bubble, M> ) -> OnPointer<E>
Run a callback system any time this event listener is triggered.
sourcepub fn add_command<C>() -> OnPointer<E>where
C: From<ListenedEvent<E>> + Command + Send + Sync + 'static,
pub fn add_command<C>() -> OnPointer<E>where C: From<ListenedEvent<E>> + Command + Send + Sync + 'static,
Add a single [Command
] any time this event listener is triggered. The command must
implement From<ListenedEvent<E>>
.
sourcepub fn commands_mut(
func: fn(_: &ListenedEvent<E>, _: &mut Commands<'_, '_>)
) -> OnPointer<E>
pub fn commands_mut( func: fn(_: &ListenedEvent<E>, _: &mut Commands<'_, '_>) ) -> OnPointer<E>
Get mutable access to [Commands
] any time this event listener is triggered.
sourcepub fn target_commands_mut(
func: fn(_: &ListenedEvent<E>, _: &mut EntityCommands<'_, '_, '_>)
) -> OnPointer<E>
pub fn target_commands_mut( func: fn(_: &ListenedEvent<E>, _: &mut EntityCommands<'_, '_, '_>) ) -> OnPointer<E>
Get mutable access to the target entity’s [EntityCommands
] using a closure any time this
event listener is triggered.
sourcepub fn target_insert(bundle: impl Bundle + Clone) -> OnPointer<E>
pub fn target_insert(bundle: impl Bundle + Clone) -> OnPointer<E>
Insert a bundle on the target entity any time this event listener is triggered.
sourcepub fn target_remove<B>() -> OnPointer<E>where
B: Bundle,
pub fn target_remove<B>() -> OnPointer<E>where B: Bundle,
Remove a bundle from the target entity any time this event listener is triggered.
sourcepub fn target_component_mut<C>(
func: fn(_: &ListenedEvent<E>, _: &mut C)
) -> OnPointer<E>where
C: Component,
pub fn target_component_mut<C>( func: fn(_: &ListenedEvent<E>, _: &mut C) ) -> OnPointer<E>where C: Component,
Get mutable access to a specific component on the target entity using a closure any time this event listener is triggered. If the component does not exist, an error will be logged.
sourcepub fn send_event<F>() -> OnPointer<E>where
F: Event + From<ListenedEvent<E>>,
pub fn send_event<F>() -> OnPointer<E>where F: Event + From<ListenedEvent<E>>,
Send an event F
any time this event listener is triggered. F
must implement
From<ListenedEvent<E>>
.
Trait Implementations§
source§impl<E> Component for OnPointer<E>where
E: IsPointerEvent,
OnPointer<E>: Send + Sync + 'static,
impl<E> Component for OnPointer<E>where E: IsPointerEvent, OnPointer<E>: Send + Sync + 'static,
source§impl<E> GetTypeRegistration for OnPointer<E>where
E: IsPointerEvent,
CallbackSystem<E>: Any + Send + Sync,
impl<E> GetTypeRegistration for OnPointer<E>where E: IsPointerEvent, CallbackSystem<E>: Any + Send + Sync,
fn get_type_registration() -> TypeRegistration
source§impl<E> Reflect for OnPointer<E>where
E: IsPointerEvent,
CallbackSystem<E>: Any + Send + Sync,
impl<E> Reflect for OnPointer<E>where E: IsPointerEvent, CallbackSystem<E>: Any + Send + Sync,
source§fn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
TypeInfo
] of the underlying type. Read moresource§fn into_any(self: Box<OnPointer<E>, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<OnPointer<E>, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Any>
.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.source§fn into_reflect(
self: Box<OnPointer<E>, Global>
) -> Box<dyn Reflect + 'static, Global>
fn into_reflect( self: Box<OnPointer<E>, Global> ) -> Box<dyn Reflect + 'static, Global>
source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
source§fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
Reflect
trait object. Read moresource§fn 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>>
source§fn apply(&mut self, value: &(dyn Reflect + 'static))
fn apply(&mut self, value: &(dyn Reflect + 'static))
source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
source§fn reflect_owned(self: Box<OnPointer<E>, Global>) -> ReflectOwned
fn reflect_owned(self: Box<OnPointer<E>, Global>) -> ReflectOwned
source§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 debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
source§impl<E> Struct for OnPointer<E>where
E: IsPointerEvent,
CallbackSystem<E>: Any + Send + Sync,
impl<E> Struct for OnPointer<E>where E: IsPointerEvent, CallbackSystem<E>: Any + Send + Sync,
source§fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn Reflect + 'static)>
name
as a &dyn Reflect
.source§fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>
fn field_mut(&mut self, name: &str) -> Option<&mut (dyn Reflect + 'static)>
name
as a
&mut dyn Reflect
.source§fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn Reflect + 'static)>
index
as a
&dyn Reflect
.source§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
.source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index
.source§fn iter_fields(&self) -> FieldIter<'_>
fn iter_fields(&self) -> FieldIter<'_>
source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
DynamicStruct
].Auto Trait Implementations§
impl<E> !RefUnwindSafe for OnPointer<E>
impl<E> Send for OnPointer<E>
impl<E> Sync for OnPointer<E>
impl<E> Unpin for OnPointer<E>
impl<E> !UnwindSafe for OnPointer<E>
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.source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§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
.§fn 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
.§fn 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.§fn 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.§impl<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 reflect_path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'r, 'p>( &'r self, path: &'p str ) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn reflect_path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'r, 'p>( &'r mut self, path: &'p str ) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more