pub struct MutableInputStreams<'a> {Show 13 fields
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<GamepadEvent>,
pub keycodes: &'a mut Input<KeyCode>,
pub scan_codes: &'a mut Input<ScanCode>,
pub keyboard_events: &'a mut Events<KeyboardInput>,
pub mouse_buttons: &'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<GamepadEvent>
Events used for mocking gamepad-related inputs
keycodes: &'a mut Input<KeyCode>
A [KeyCode
] [Input
] stream
scan_codes: &'a mut Input<ScanCode>
A [ScanCode
] [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§
source§impl<'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§
source§impl<'a> Debug for MutableInputStreams<'a>
impl<'a> Debug for MutableInputStreams<'a>
source§impl<'a> From<&'a MutableInputStreams<'a>> for InputStreams<'a>
impl<'a> From<&'a MutableInputStreams<'a>> for InputStreams<'a>
source§fn from(mutable_streams: &'a MutableInputStreams<'a>) -> Self
fn from(mutable_streams: &'a MutableInputStreams<'a>) -> Self
source§impl<'a> From<MutableInputStreams<'a>> for InputStreams<'a>
impl<'a> From<MutableInputStreams<'a>> for InputStreams<'a>
source§fn from(mutable_streams: MutableInputStreams<'a>) -> Self
fn from(mutable_streams: MutableInputStreams<'a>) -> Self
source§impl MockInput for MutableInputStreams<'_>
impl MockInput for MutableInputStreams<'_>
source§fn send_input(&mut self, input: impl Into<UserInput>)
fn send_input(&mut self, input: impl Into<UserInput>)
user_input
directly Read moresource§fn 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> )
user_input
directly, using the specified gamepad Read moresource§fn release_input(&mut self, input: impl Into<UserInput>)
fn release_input(&mut self, input: impl Into<UserInput>)
user_input
directly Read moresource§fn 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> )
user_input
directly, using the specified gamepad Read moresource§fn pressed(&self, input: impl Into<UserInput>) -> bool
fn pressed(&self, input: impl Into<UserInput>) -> bool
user_input
pressed? Read moresource§fn 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
source§fn reset_inputs(&mut self)
fn reset_inputs(&mut self)
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 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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, 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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.