pub struct MouseState {
pub mouse_cursor_type: Option<MouseCursorType>,
pub cursor_position: CursorPosition,
pub is_cursor_locked: bool,
pub left_down: bool,
pub right_down: bool,
pub middle_down: bool,
pub scroll_x: Option<f32>,
pub scroll_y: Option<f32>,
}
Expand description
Mouse position, cursor type, user scroll input, etc.
Fields§
§mouse_cursor_type: Option<MouseCursorType>
Current mouse cursor type, set to None
if the cursor is hidden. (READWRITE)
cursor_position: CursorPosition
Where is the mouse cursor currently? Set to None
if the window is not focused. (READWRITE)
is_cursor_locked: bool
Is the mouse cursor locked to the current window (important for applications like games)? (READWRITE)
left_down: bool
Is the left mouse button down? (READONLY)
right_down: bool
Is the right mouse button down? (READONLY)
middle_down: bool
Is the middle mouse button down? (READONLY)
scroll_x: Option<f32>
Scroll amount in pixels in the horizontal direction. Gets reset to 0 after every frame (READONLY)
scroll_y: Option<f32>
Scroll amount in pixels in the vertical direction. Gets reset to 0 after every frame (READONLY)
Implementations§
Source§impl MouseState
impl MouseState
Sourcepub fn mouse_down(&self) -> bool
pub fn mouse_down(&self) -> bool
Returns whether any mouse button (left, right or center) is currently held down
pub fn get_scroll_x(&self) -> f32
pub fn get_scroll_y(&self) -> f32
pub fn get_scroll(&self) -> (f32, f32)
Trait Implementations§
Source§impl Clone for MouseState
impl Clone for MouseState
Source§fn clone(&self) -> MouseState
fn clone(&self) -> MouseState
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MouseState
impl Debug for MouseState
Source§impl Default for MouseState
impl Default for MouseState
Source§impl PartialEq for MouseState
impl PartialEq for MouseState
Source§impl PartialOrd for MouseState
impl PartialOrd for MouseState
impl Copy for MouseState
impl StructuralPartialEq for MouseState
Auto Trait Implementations§
impl Freeze for MouseState
impl RefUnwindSafe for MouseState
impl Send for MouseState
impl Sync for MouseState
impl Unpin for MouseState
impl UnwindSafe for MouseState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)