Class Mouse
The state of the mouse.
Inherited Members
Namespace: SadConsole.Input
Assembly: SadConsole.dll
Syntax
public class Mouse
Constructors
Mouse()
Declaration
public Mouse()
Properties
IsOnScreen
Indicates that the mouse is currently within the bounds of the rendering area.
Declaration
public bool IsOnScreen { get; }
Property Value
Type | Description |
---|---|
bool |
LeftButtonDown
Indicates the left mouse button is currently being pressed.
Declaration
public bool LeftButtonDown { get; set; }
Property Value
Type | Description |
---|---|
bool |
LeftButtonDownDuration
The amount of time the left button has been held down.
Declaration
public TimeSpan LeftButtonDownDuration { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
LeftClicked
Indicates the left mouse button was clicked. (Held and then released)
Declaration
public bool LeftClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
LeftDoubleClicked
Indicates the left mouse button was double-clicked within one second.
Declaration
public bool LeftDoubleClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
MiddleButtonDown
Indicates the middle mouse button is currently being pressed.
Declaration
public bool MiddleButtonDown { get; set; }
Property Value
Type | Description |
---|---|
bool |
MiddleButtonDownDuration
The amount of time the middle button has been held down.
Declaration
public TimeSpan MiddleButtonDownDuration { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
MiddleClicked
Indicates the middle mouse button was clicked. (Held and then released)
Declaration
public bool MiddleClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
MiddleDoubleClicked
Indicates the middle mouse button was double-clicked within one second.
Declaration
public bool MiddleDoubleClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
RightButtonDown
Indicates the right mouse button is currently being pressed.
Declaration
public bool RightButtonDown { get; set; }
Property Value
Type | Description |
---|---|
bool |
RightButtonDownDuration
The amount of time the right button has been held down.
Declaration
public TimeSpan RightButtonDownDuration { get; }
Property Value
Type | Description |
---|---|
TimeSpan |
RightClicked
Indicates the right mouse button was clicked. (Held and then released)
Declaration
public bool RightClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
RightDoubleClicked
Indicates the right mouse button was double-clicked within one second.
Declaration
public bool RightDoubleClicked { get; set; }
Property Value
Type | Description |
---|---|
bool |
ScreenPosition
The pixel position of the mouse on the screen.
Declaration
public Point ScreenPosition { get; set; }
Property Value
Type | Description |
---|---|
Point |
ScrollWheelValue
The cumulative value of the scroll wheel.
Declaration
public int ScrollWheelValue { get; set; }
Property Value
Type | Description |
---|---|
int |
ScrollWheelValueChange
The scroll wheel value change between frames.
Declaration
public int ScrollWheelValueChange { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
Clear()
Clears the buttons, position, wheel information.
Declaration
public void Clear()
ClearLastMouseScreenObject()
Unlocks the last screen object the mouse was locked to. Allows another console to become locked to the mouse.
Declaration
public void ClearLastMouseScreenObject()
Clone()
Clones this mouse into a new object.
Declaration
public Mouse Clone()
Returns
Type | Description |
---|---|
Mouse | A clone. |
IsMouseOverScreenObjectSurface(IScreenSurface)
Returns true when the mouse is currently over the provided screen object.
Declaration
public bool IsMouseOverScreenObjectSurface(IScreenSurface screenObject)
Parameters
Type | Name | Description |
---|---|---|
IScreenSurface | screenObject | The screen object to check. |
Returns
Type | Description |
---|---|
bool | True or false indicating if the mouse is over the screen object. |
Process()
Builds information about the mouse state based on the FocusedScreenObjects or Screen. Should be called each frame.
Declaration
public virtual void Process()
Update(TimeSpan)
Reads the mouse state from GetMouseState().
Declaration
public void Update(TimeSpan elapsedSeconds)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | elapsedSeconds | Fractional seconds passed since Update was called. |