Skip to main content

MouseProvider

Trait MouseProvider 

Source
pub trait MouseProvider {
    // Required methods
    fn get_mouse_position(&self) -> Vector2;
    fn mouse_button_down(&self, button: MouseButton) -> bool;
    fn get_mouse_wheel_move_v(&self) -> Vector2;
}
Expand description

Provides current-frame mouse state.

Required Methods§

Source

fn get_mouse_position(&self) -> Vector2

Returns mouse position in pixel coordinates.

Source

fn mouse_button_down(&self, button: MouseButton) -> bool

Returns whether the button is currently down.

Source

fn get_mouse_wheel_move_v(&self) -> Vector2

Returns mouse wheel delta for the current frame.

By convention, x is horizontal scroll and y is vertical scroll.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: MouseProvider> MouseProvider for Arc<T>

Delegates mouse access to the inner provider behind an Arc.

Source§

impl<T: MouseProvider> MouseProvider for Mutex<T>

Delegates mouse access to the inner provider behind a Mutex.

§Panics

Panics if the mutex is poisoned.

Implementors§