#[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