Mouse

Struct Mouse 

Source
pub struct Mouse {}
Expand description

An interface for handling mouse inputs.

Implementations§

Source§

impl Mouse

Source

pub fn get_position() -> Vec2

The position of the mouse in the visible window. You can use Mouse::get_position() * App::get_device_pixel_ratio() to get the coordinate in the game world. Then use node.convertToNodeSpace() to convert the world coordinate to the local coordinate of the node.

§Example
let worldPos = Mouse::get_position() * App::get_device_pixel_ratio();
let nodePos = node.convert_to_node_space(&worldPos);
Source

pub fn is_left_button_pressed() -> bool

Whether the left mouse button is currently being pressed.

Source

pub fn is_right_button_pressed() -> bool

Whether the right mouse button is currently being pressed.

Source

pub fn is_middle_button_pressed() -> bool

Whether the middle mouse button is currently being pressed.

Source

pub fn get_wheel() -> Vec2

Gets the mouse wheel value.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.