pub struct MouseBuf {
pub delta: (f32, f32),
pub wheel: (f32, f32),
pub x: f32,
pub y: f32,
/* private fields */
}Expand description
A container for Window-based mouse, tablet and touch input events.
Fields§
§delta: (f32, f32)Amount of mouse movement detected since the last update.
wheel: (f32, f32)Amount of wheel scroll detected since the last update.
x: f32The x-axis mouse position in pixels.
y: f32The y-axis mouse position in pixels.
Implementations§
source§impl MouseBuf
impl MouseBuf
sourcepub fn any_held(&self) -> bool
pub fn any_held(&self) -> bool
Returns true if any buttons have been pressed for multiple frames.
sourcepub fn any_pressed(&self) -> bool
pub fn any_pressed(&self) -> bool
Returns true if any buttons have been pressed since the last frame.
sourcepub fn any_released(&self) -> bool
pub fn any_released(&self) -> bool
Returns true if any buttons have been released since the last frame.
sourcepub fn handle_event(&mut self, event: &Event<()>) -> bool
pub fn handle_event(&mut self, event: &Event<()>) -> bool
Handles a single event.
sourcepub fn is_held(&self, button: MouseButton) -> bool
pub fn is_held(&self, button: MouseButton) -> bool
Returns true if the given button has been pressed for multiple frames.
sourcepub fn is_pressed(&self, button: MouseButton) -> bool
pub fn is_pressed(&self, button: MouseButton) -> bool
Returns true if the given button has been pressed since the last frame.
sourcepub fn is_released(&self, button: MouseButton) -> bool
pub fn is_released(&self, button: MouseButton) -> bool
Returns true if the given button has been released since the last frame.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for MouseBuf
impl Send for MouseBuf
impl Sync for MouseBuf
impl Unpin for MouseBuf
impl UnwindSafe for MouseBuf
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§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>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.