pub struct Mouse {}Expand description
An interface for handling mouse inputs.
Implementations§
Source§impl Mouse
impl Mouse
Sourcepub fn get_position() -> Vec2
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);Whether the left mouse button is currently being pressed.
Whether the right mouse button is currently being pressed.
Whether the middle mouse button is currently being pressed.
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
Mutably borrows from an owned value. Read more