Struct MouseState
Encapsulates the state of a mouse device.
Implements
Inherited Members
Namespace: OpenTK.Input
Assembly: OpenTK.dll
Syntax
public struct MouseState : IEquatable<MouseState>
Properties
IsAnyButtonDown
Gets a value indicating whether any button is down.
Declaration
public readonly bool IsAnyButtonDown { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
IsConnected
Gets a value indicating whether this instance is connected.
Declaration
public bool IsConnected { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
Item[MouseButton]
Gets a Boolean indicating whether the specified MouseButton is pressed.
Declaration
public bool this[MouseButton button] { get; }
Parameters
Type | Name | Description |
---|---|---|
MouseButton | button | The MouseButton to check. |
Property Value
Type | Description |
---|---|
Boolean | True if key is pressed; false otherwise. |
LeftButton
Gets a Boolean indicating whether the left mouse button is pressed. This property is intended for XNA compatibility.
Declaration
public readonly ButtonState LeftButton { get; }
Property Value
Type | Description |
---|---|
ButtonState |
MiddleButton
Gets a Boolean indicating whether the middle mouse button is pressed. This property is intended for XNA compatibility.
Declaration
public readonly ButtonState MiddleButton { get; }
Property Value
Type | Description |
---|---|
ButtonState |
RightButton
Gets a Boolean indicating whether the right mouse button is pressed. This property is intended for XNA compatibility.
Declaration
public readonly ButtonState RightButton { get; }
Property Value
Type | Description |
---|---|
ButtonState |
Scroll
Gets a MouseScroll instance, representing the current state of the mouse scroll wheel.
Declaration
public readonly MouseScroll Scroll { get; }
Property Value
Type | Description |
---|---|
MouseScroll |
ScrollWheelValue
Gets the absolute wheel position in integer units. This property is intended for XNA compatibility. To support high-precision mice, it is recommended to use WheelPrecise instead.
Declaration
public readonly int ScrollWheelValue { get; }
Property Value
Type | Description |
---|---|
Int32 |
Wheel
Gets the absolute wheel position in integer units. To support high-precision mice, it is recommended to use WheelPrecise instead.
Declaration
public readonly int Wheel { get; }
Property Value
Type | Description |
---|---|
Int32 |
WheelPrecise
Gets the absolute wheel position in floating-point units.
Declaration
public readonly float WheelPrecise { get; }
Property Value
Type | Description |
---|---|
Single |
X
Gets an integer representing the absolute x position of the pointer, in window pixel coordinates.
Declaration
public int X { get; }
Property Value
Type | Description |
---|---|
Int32 |
XButton1
Gets a Boolean indicating whether the first extra mouse button is pressed. This property is intended for XNA compatibility.
Declaration
public readonly ButtonState XButton1 { get; }
Property Value
Type | Description |
---|---|
ButtonState |
XButton2
Gets a Boolean indicating whether the second extra mouse button is pressed. This property is intended for XNA compatibility.
Declaration
public readonly ButtonState XButton2 { get; }
Property Value
Type | Description |
---|---|
ButtonState |
Y
Gets an integer representing the absolute y position of the pointer, in window pixel coordinates.
Declaration
public int Y { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Equals(MouseState)
Compares two MouseState instances.
Declaration
public bool Equals(MouseState other)
Parameters
Type | Name | Description |
---|---|---|
MouseState | other | The instance to compare two. |
Returns
Type | Description |
---|---|
Boolean | True, if both instances are equal; false otherwise. |
Equals(Object)
Compares to an object instance for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare to. |
Returns
Type | Description |
---|---|
Boolean | True if this instance is equal to obj; false otherwise. |
Overrides
GetHashCode()
Generates a hashcode for the current instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A Int32 represting the hashcode for this instance. |
Overrides
IsButtonDown(MouseButton)
Gets a Boolean indicating whether this button is down.
Declaration
public bool IsButtonDown(MouseButton button)
Parameters
Type | Name | Description |
---|---|---|
MouseButton | button | The MouseButton to check. |
Returns
Type | Description |
---|---|
Boolean |
IsButtonUp(MouseButton)
Gets a Boolean indicating whether this button is up.
Declaration
public bool IsButtonUp(MouseButton button)
Parameters
Type | Name | Description |
---|---|---|
MouseButton | button | The MouseButton to check. |
Returns
Type | Description |
---|---|
Boolean |
ToString()
Returns a String that represents the current MouseState.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A String that represents the current MouseState. |
Overrides
Operators
Equality(MouseState, MouseState)
Checks whether two MouseState instances are equal.
Declaration
public static bool operator ==(MouseState left, MouseState right)
Parameters
Type | Name | Description |
---|---|---|
MouseState | left | A MouseState instance. |
MouseState | right | A MouseState instance. |
Returns
Type | Description |
---|---|
Boolean | True if both left is equal to right; false otherwise. |
Inequality(MouseState, MouseState)
Checks whether two MouseState instances are not equal.
Declaration
public static bool operator !=(MouseState left, MouseState right)
Parameters
Type | Name | Description |
---|---|---|
MouseState | left | A MouseState instance. |
MouseState | right | A MouseState instance. |
Returns
Type | Description |
---|---|
Boolean | True if both left is not equal to right; false otherwise. |