Class MouseDispatcher
Inheritance
Inherited Members
Namespace: Evergine.Common.Input.Mouse
Assembly: Evergine.Common.dll
Syntax
public abstract class MouseDispatcher : PointerDispatcher
Constructors
MouseDispatcher()
Initializes a new instance of the MouseDispatcher class.
Declaration
public MouseDispatcher()
Properties
CursorType
Gets the active cursor type. It can be changed by calling the method TrySetCursorType(CursorTypes).
Declaration
public abstract CursorTypes CursorType { get; }
Property Value
Type | Description |
---|---|
CursorTypes |
IsMouseOver
Declaration
public bool IsMouseOver { get; }
Property Value
Type | Description |
---|---|
bool |
Position
Gets the mouse position. It can be changed programmatically by calling the method TrySetCursorPosition(Point).
Declaration
public Point Position { get; }
Property Value
Type | Description |
---|---|
Point |
PositionDelta
Gets the mouse position delta since the last frame.
Declaration
public Point PositionDelta { get; }
Property Value
Type | Description |
---|---|
Point |
ScrollDelta
Gets the mouse scroll increment since the last frame.
Declaration
public Point ScrollDelta { get; }
Property Value
Type | Description |
---|---|
Point |
Remarks
The value of X indicates the horizontal scroll increment. This value is positive if the mouse wheel is rotated to the right or negative if the mouse wheel is rotated to the left. The value of Y indicates the vertical scroll increment. This value is positive if the mouse wheel is rotated upward (away from the user) or negative if the mouse wheel is rotated downward (toward the user).
State
Gets the mouse button's state.
Declaration
public MouseButtons State { get; }
Property Value
Type | Description |
---|---|
MouseButtons |
Methods
DispatchEvents()
Dispatches accumulated events.
Declaration
public override void DispatchEvents()
Overrides
HandleMouseButtonDown(MouseButtons)
Handles the mouse button down event.
Declaration
protected void HandleMouseButtonDown(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The pressed button. |
HandleMouseButtonUp(MouseButtons)
Handles the mouse button up event.
Declaration
protected void HandleMouseButtonUp(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The button released. |
HandleMouseEnter(Point)
Handles the mouse enter event.
Declaration
protected void HandleMouseEnter(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The mouse's position. |
HandleMouseLeave(Point)
Handles the mouse leave event.
Declaration
protected void HandleMouseLeave(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The position of the mouse. |
HandleMouseMove(Point)
Handles the mouse movement event.
Declaration
protected void HandleMouseMove(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The mouse position. |
HandleMouseScroll(MouseScrollDirections)
Handles the mouse button scroll event.
Declaration
protected void HandleMouseScroll(MouseScrollDirections direction)
Parameters
Type | Name | Description |
---|---|---|
MouseScrollDirections | direction | The direction of the scroll. |
IsButtonDown(MouseButtons)
Declaration
public bool IsButtonDown(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The button to check. |
Returns
Type | Description |
---|---|
bool |
|
NativeSetCursorPosition(Point)
Sets the cursor position natively.
Declaration
protected abstract bool NativeSetCursorPosition(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The new position. |
Returns
Type | Description |
---|---|
bool | True if the operation was successful; false otherwise. |
ReadButtonState(MouseButtons)
Gets the current state of a mouse button.
Declaration
public ButtonState ReadButtonState(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The button to check. |
Returns
Type | Description |
---|---|
ButtonState | The state of the specified button. |
ResetPointersStatus()
Resets the current button status for the dispatcher.
Declaration
protected override void ResetPointersStatus()
Overrides
TrySetCursorPosition(Point)
Attempts to move the mouse cursor to the specified position.
Declaration
public bool TrySetCursorPosition(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The new position for the cursor. |
Returns
Type | Description |
---|---|
bool |
|
TrySetCursorType(CursorTypes)
Tries to change the mouse cursor type.
Declaration
public abstract bool TrySetCursorType(CursorTypes cursorType)
Parameters
Type | Name | Description |
---|---|---|
CursorTypes | cursorType | The new cursor type. |
Returns
Type | Description |
---|---|
bool |
|
Events
MouseButtonDown
Occurs when a mouse button is pressed.
Declaration
public event EventHandler<MouseButtonEventArgs> MouseButtonDown
Event Type
Type | Description |
---|---|
EventHandler<MouseButtonEventArgs> |
MouseButtonUp
Occurs when a mouse button is released.
Declaration
public event EventHandler<MouseButtonEventArgs> MouseButtonUp
Event Type
Type | Description |
---|---|
EventHandler<MouseButtonEventArgs> |
MouseEnter
Declaration
public event EventHandler<MouseEventArgs> MouseEnter
Event Type
Type | Description |
---|---|
EventHandler<MouseEventArgs> |
MouseLeave
Declaration
public event EventHandler<MouseEventArgs> MouseLeave
Event Type
Type | Description |
---|---|
EventHandler<MouseEventArgs> |
MouseMove
Declaration
public event EventHandler<MouseEventArgs> MouseMove
Event Type
Type | Description |
---|---|
EventHandler<MouseEventArgs> |
MouseScroll
Occurs when the mouse wheel (vertical or horizontal) moves.
Declaration
public event EventHandler<MouseScrollEventArgs> MouseScroll
Event Type
Type | Description |
---|---|
EventHandler<MouseScrollEventArgs> |