#[repr(C)]pub struct Mouse {
pub available: Bool32T,
pub pos: Vec2,
pub pos_change: Vec2,
pub scroll: f32,
pub scroll_change: f32,
}
Expand description
This stores information about the mouse! What’s its state, where’s it pointed, do we even have one? https://stereokit.net/Pages/StereoKit/Mouse.html
see also Input::get_mouse
§Examples
use stereokit_rust::{system::Input, maths::{Vec2, Vec3}};
let mouse = Input::get_mouse();
assert_eq!(mouse.is_available(),false);
assert_eq!(mouse.pos, Vec2::ZERO);
assert_eq!(mouse.pos_change, Vec2::ZERO);
assert_eq!(mouse.scroll, 0.0);
assert_eq!(mouse.scroll_change, 0.0);
assert_eq!(mouse.get_ray().position, Vec3::ZERO);
// Warning: No ray if the mouse isn't available!
// assert_eq!(mouse.get_ray().direction, Vec3::new(f32::NAN, f32::NAN, f32::NAN));
Fields§
§available: Bool32T
Is the mouse available to use? Most MR systems likely won’t have a mouse!
pos: Vec2
Position of the mouse relative to the window it’s in! This is the number of pixels from the top left corner of the screen.
pos_change: Vec2
How much has the mouse’s position changed in the current frame? Measured in pixels.
scroll: f32
What’s the current scroll value for the mouse’s scroll wheel? TODO: Units
scroll_change: f32
How much has the scroll wheel value changed during this frame? TODO: Units
Implementations§
Source§impl Mouse
impl Mouse
Sourcepub fn get_ray(&self) -> Ray
pub fn get_ray(&self) -> Ray
Ray representing the position and orientation that the current Input::get_mouse() is pointing in. https://stereokit.net/Pages/StereoKit/Mouse/Ray.html
see also ray_from_mouse
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Is the mouse available ? https://stereokit.net/Pages/StereoKit/Mouse/Available.html
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mouse
impl RefUnwindSafe for Mouse
impl Send for Mouse
impl Sync for Mouse
impl Unpin for Mouse
impl UnwindSafe for Mouse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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
.Source§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
.Source§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.Source§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.