Struct rusty_engine::mouse::MouseState
source · pub struct MouseState { /* private fields */ }
Expand description
MouseState
represents the end-state of the mouse during the last frame. This should be used
for “real time” processing of most input (except mousewheel scrolling), where you only care
about the final state of buttons or mouse position for your logic.
If you need to process all mouse events that occurred during a single frame, use the
mouse_button_events
, mouse_location_events
, mouse_motion_events
, or mouse_wheel_events
fields on Engine
.
Implementations§
source§impl MouseState
impl MouseState
sourcepub fn location(&self) -> Option<Vec2>
pub fn location(&self) -> Option<Vec2>
Final location of the mouse this frame. If you want to process all the locations the mouse
was at during this frame, see
Engine::mouse_location_events
instead.
sourcepub fn motion(&self) -> Vec2
pub fn motion(&self) -> Vec2
The cumulative relative motion of the mouse this frame. If you want to process all the individual relative motions, see `Engine::mouse_motion_events instead.
sourcepub fn wheel(&self) -> MouseWheelState
pub fn wheel(&self) -> MouseWheelState
sourcepub fn pressed(&self, mouse_button: MouseButton) -> bool
pub fn pressed(&self, mouse_button: MouseButton) -> bool
Returns true if the mouse button was pressed
sourcepub fn just_pressed(&self, mouse_button: MouseButton) -> bool
pub fn just_pressed(&self, mouse_button: MouseButton) -> bool
Returns true if the mouse button started being pressed during the last frame
sourcepub fn just_released(&self, mouse_button: MouseButton) -> bool
pub fn just_released(&self, mouse_button: MouseButton) -> bool
Returns true if the mouse button started being released during the last frame
sourcepub fn pressed_any(&self, mouse_buttons: &[MouseButton]) -> bool
pub fn pressed_any(&self, mouse_buttons: &[MouseButton]) -> bool
Returns true if any of the indicated mouse buttons were pressed
sourcepub fn just_pressed_any(&self, mouse_buttons: &[MouseButton]) -> bool
pub fn just_pressed_any(&self, mouse_buttons: &[MouseButton]) -> bool
Returns true if any of the indicated mouse buttons were just pressed this frame
sourcepub fn just_released_any(&self, mouse_buttons: &[MouseButton]) -> bool
pub fn just_released_any(&self, mouse_buttons: &[MouseButton]) -> bool
Returns true if any of the indicated mouse buttons were just released this frame
pub fn chain(&self) -> MouseStateChain
Trait Implementations§
source§impl Clone for MouseState
impl Clone for MouseState
source§fn clone(&self) -> MouseState
fn clone(&self) -> MouseState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MouseState
impl Debug for MouseState
source§impl Default for MouseState
impl Default for MouseState
source§fn default() -> MouseState
fn default() -> MouseState
impl Resource for MouseState
Auto Trait Implementations§
impl RefUnwindSafe for MouseState
impl Send for MouseState
impl Sync for MouseState
impl Unpin for MouseState
impl UnwindSafe for MouseState
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
§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>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.