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 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. Can be changed programmatically calling the method TrySetCursorPosition(Point).
Declaration
public Point Position { get; }
Property Value
Type | Description |
---|---|
Point |
PositionDelta
Gets the mouse delta position 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 in an upward direction (away from the user) or negative if the mouse wheel is rotated in a downward direction (toward the user).
State
Gets the mouse buttons state.
Declaration
public MouseButtons State { get; }
Property Value
Type | Description |
---|---|
MouseButtons |
Methods
DispatchEvents()
Dispatch 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 button pressed. |
HandleMouseButtonUp(MouseButtons)
Handles the mouse button up event.
Declaration
protected void HandleMouseButtonUp(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The button pressed. |
HandleMouseEnter(Point)
Handles the mouse enter event.
Declaration
protected void HandleMouseEnter(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The mouse position. |
HandleMouseLeave(Point)
Handles the mouse leave event.
Declaration
protected void HandleMouseLeave(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position | The mouse position. |
HandleMouseMove(Point)
Handles the mouse move 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 scroll direction. |
IsButtonDown(MouseButtons)
Declaration
public bool IsButtonDown(MouseButtons button)
Parameters
Type | Name | Description |
---|---|---|
MouseButtons | button | The button to be checked. |
Returns
Type | Description |
---|---|
bool |
|
NativeSetCursorPosition(Point)
Sets natively the cursor position.
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 be checked. |
Returns
Type | Description |
---|---|
ButtonState | The state of the specified button. |
TrySetCursorPosition(Point)
Tries 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> |