pub struct MutableInputStreams<'a> {
pub gamepad_buttons: &'a mut Input<GamepadButton>,
pub gamepad_button_axes: &'a mut Axis<GamepadButton>,
pub gamepad_axes: &'a mut Axis<GamepadAxis>,
pub gamepads: &'a mut Gamepads,
pub gamepad_events: &'a mut Events<GamepadEventRaw>,
pub keycode: &'a mut Input<KeyCode>,
pub keyboard_events: &'a mut Events<KeyboardInput>,
pub mouse_button: &'a mut Input<MouseButton>,
pub mouse_button_events: &'a mut Events<MouseButtonInput>,
pub mouse_wheel: &'a mut Events<MouseWheel>,
pub mouse_motion: &'a mut Events<MouseMotion>,
pub associated_gamepad: Option<Gamepad>,
}
Expand description
A mutable collection of [Input
] structs, which can be used for mocking user inputs.
These are typically collected via a system from the World
as resources.
Fields
A [GamepadButton
] [Input
] stream
A [GamepadButton
] [Axis
] stream
gamepad_axes: &'a mut Axis<GamepadAxis>
A [GamepadAxis
] [Axis
] stream
gamepads: &'a mut Gamepads
A list of registered [Gamepads
]
gamepad_events: &'a mut Events<GamepadEventRaw>
Events used for mocking gamepad-related inputs
keycode: &'a mut Input<KeyCode>
A [KeyCode
] [Input
] stream
keyboard_events: &'a mut Events<KeyboardInput>
Events used for mocking keyboard-related inputs
A [MouseButton
] [Input
] stream
Events used for mocking [MouseButton
] inputs
mouse_wheel: &'a mut Events<MouseWheel>
A [MouseWheel
] event stream
mouse_motion: &'a mut Events<MouseMotion>
A [MouseMotion
] event stream
associated_gamepad: Option<Gamepad>
The [Gamepad
] that this struct will detect inputs from
Implementations
sourceimpl<'a> MutableInputStreams<'a>
impl<'a> MutableInputStreams<'a>
sourcepub fn from_world(world: &'a mut World, gamepad: Option<Gamepad>) -> Self
pub fn from_world(world: &'a mut World, gamepad: Option<Gamepad>) -> Self
Construct a MutableInputStreams
from the [World
]
sourcepub fn guess_gamepad(&self) -> Option<Gamepad>
pub fn guess_gamepad(&self) -> Option<Gamepad>
Guess which registered [Gamepad
] should be used.
If an associated gamepad is set, use that. Otherwise use the first registered gamepad, if any.
Trait Implementations
sourceimpl<'a> Debug for MutableInputStreams<'a>
impl<'a> Debug for MutableInputStreams<'a>
sourceimpl<'a> From<&'a MutableInputStreams<'a>> for InputStreams<'a>
impl<'a> From<&'a MutableInputStreams<'a>> for InputStreams<'a>
sourcefn from(mutable_streams: &'a MutableInputStreams<'a>) -> Self
fn from(mutable_streams: &'a MutableInputStreams<'a>) -> Self
Converts to this type from the input type.
sourceimpl<'a> From<MutableInputStreams<'a>> for InputStreams<'a>
impl<'a> From<MutableInputStreams<'a>> for InputStreams<'a>
sourcefn from(mutable_streams: MutableInputStreams<'a>) -> Self
fn from(mutable_streams: MutableInputStreams<'a>) -> Self
Converts to this type from the input type.
sourceimpl MockInput for MutableInputStreams<'_>
impl MockInput for MutableInputStreams<'_>
sourcefn send_input(&mut self, input: impl Into<UserInput>)
fn send_input(&mut self, input: impl Into<UserInput>)
Send the specified user_input
directly Read more
sourcefn send_input_as_gamepad(
&mut self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
)
fn send_input_as_gamepad(
&mut self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
)
Send the specified user_input
directly, using the specified gamepad Read more
sourcefn release_input(&mut self, input: impl Into<UserInput>)
fn release_input(&mut self, input: impl Into<UserInput>)
Releases the specified user_input
directly Read more
sourcefn release_input_as_gamepad(
&mut self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
)
fn release_input_as_gamepad(
&mut self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
)
Releases the specified user_input
directly, using the specified gamepad Read more
sourcefn pressed(&self, input: impl Into<UserInput>) -> bool
fn pressed(&self, input: impl Into<UserInput>) -> bool
Is the provided user_input
pressed? Read more
sourcefn pressed_for_gamepad(
&self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
) -> bool
fn pressed_for_gamepad(
&self,
input: impl Into<UserInput>,
gamepad: Option<Gamepad>
) -> bool
Is the provided user_input
pressed for the provided [Gamepad
]? Read more
sourcefn reset_inputs(&mut self)
fn reset_inputs(&mut self)
Clears all user input streams, resetting them to their default state Read more
Presses all bevy::ui
buttons with the matching Marker
component Read more
Hovers over all bevy::ui
buttons with the matching Marker
component Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for MutableInputStreams<'a>
impl<'a> Send for MutableInputStreams<'a>
impl<'a> Sync for MutableInputStreams<'a>
impl<'a> Unpin for MutableInputStreams<'a>
impl<'a> !UnwindSafe for MutableInputStreams<'a>
Blanket Implementations
impl<T, U> AsBindGroupShaderType<U> for T where
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for T where
U: ShaderType,
&'a T: for<'a> Into<U>,
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset, RandomState, Global>
) -> U
Return the T
[ShaderType
] for self
. When used in [AsBindGroup
]
derives, it is safe to assume that all images in self
exist. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
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>
Convert 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 more
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more