Class Mouse
Represents a single hardware mouse device. Used by the Input to report raw mouse input events.
The mouse device position is in screen-space (not game client window space).
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Input/Mouse.h
Syntax
public class Mouse : public InputDevice
Constructors
Mouse()
Declaration
protected Mouse()
Fields
_prevState
_state
Methods
GetButton(MouseButton button)
Gets the mouse button state (true if being pressed during the current frame).
Declaration
public bool GetButton(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True if user holds down the button, otherwise false. |
GetButtonDown(MouseButton button)
Gets the mouse button down state (true if was pressed during the current frame).
Declaration
public bool GetButtonDown(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True if user starts pressing down the button, otherwise false. |
GetButtonUp(MouseButton button)
Gets the mouse button up state (true if was released during the current frame).
Declaration
public bool GetButtonUp(MouseButton button) const
Parameters
MouseButton
button
Mouse button to check |
Returns
bool
True if user releases the button, otherwise false. |
GetPosition()
Gets the position of the mouse in the screen-space coordinates.
Declaration
public Float2 GetPosition() const
Returns
Float2
|
GetPositionDelta()
Gets the delta position of the mouse in the screen-space coordinates.
Declaration
public Float2 GetPositionDelta() const
Returns
Float2
|
GetScrollDelta()
Gets the mouse wheel change during the last frame.
Declaration
public float GetScrollDelta() const
Returns
float
|
IsAnyButtonDown()
Checks if any mouse button is currently pressed.
Declaration
public bool IsAnyButtonDown() const
Returns
bool
|
OnMouseDoubleClick(const Float2& position, const MouseButton button, Window* target=nullptr)
Called when mouse double clicks.
Declaration
public void OnMouseDoubleClick(const Float2& position, const MouseButton button, Window* target=nullptr)
Parameters
Float2
position
The mouse position. |
MouseButton
button
The button. |
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
OnMouseDown(const Float2& position, const MouseButton button, Window* target=nullptr)
Called when mouse button goes down.
Declaration
public void OnMouseDown(const Float2& position, const MouseButton button, Window* target=nullptr)
Parameters
Float2
position
The mouse position. |
MouseButton
button
The button. |
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
OnMouseLeave(Window* target=nullptr)
Called when mouse leaves the input source area.
Declaration
public void OnMouseLeave(Window* target=nullptr)
Parameters
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
OnMouseMove(const Float2& position, Window* target=nullptr)
Called when mouse moves.
Declaration
public void OnMouseMove(const Float2& position, Window* target=nullptr)
Parameters
Float2
position
The mouse position. |
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
OnMouseMoved(const Float2& newPosition)
Called when mouse cursor gets moved by the application. Invalidates the previous cached mouse position to prevent mouse jitter when locking the cursor programmatically.
Declaration
public void OnMouseMoved(const Float2& newPosition)
Parameters
Float2
newPosition
The new mouse position. |
OnMouseUp(const Float2& position, const MouseButton button, Window* target=nullptr)
Called when mouse button goes up.
Declaration
public void OnMouseUp(const Float2& position, const MouseButton button, Window* target=nullptr)
Parameters
Float2
position
The mouse position. |
MouseButton
button
The button. |
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
OnMouseWheel(const Float2& position, float delta, Window* target=nullptr)
Called when mouse wheel moves.
Declaration
public void OnMouseWheel(const Float2& position, float delta, Window* target=nullptr)
Parameters
Float2
position
The mouse position. |
float
delta
The normalized delta (range [-1;1]). |
Window
target
The target window to receive this event, otherwise input system will pick the window automatically. |
ResetState()
Resets the input device state. Called when application looses focus.
Declaration
public virtual void ResetState() override
Overrides
SetMousePosition(const Float2& newPosition)
Sets the mouse position.
Declaration
public virtual void SetMousePosition(const Float2& newPosition) = 0
Parameters
Float2
newPosition
The new position. |
Update(EventQueue& queue)
Captures the input since the last call and triggers the input events.
Declaration
public virtual bool Update(EventQueue& queue) final override
Parameters
EventQueue
queue
The input events queue. |
Returns
bool
True if device has been disconnected, otherwise false. |