Struct MouseState
Represents a mouse state with cursor position and button press information.
public struct MouseState
- Inherited Members
Constructors
MouseState(int, int, int, ButtonState, ButtonState, ButtonState, ButtonState, ButtonState)
Initializes a new instance of the MouseState.
public MouseState(int x, int y, int scrollWheel, ButtonState leftButton, ButtonState middleButton, ButtonState rightButton, ButtonState xButton1, ButtonState xButton2)
Parameters
x
intHorizontal position of the mouse in relation to the window.
y
intVertical position of the mouse in relation to the window.
scrollWheel
intMouse scroll wheel's value.
leftButton
ButtonStateLeft mouse button's state.
middleButton
ButtonStateMiddle mouse button's state.
rightButton
ButtonStateRight mouse button's state.
xButton1
ButtonStateXBUTTON1's state.
xButton2
ButtonStateXBUTTON2's state.
Remarks
Normally GetState() should be used to get mouse current state. The constructor is provided for simulating mouse input.
MouseState(int, int, int, ButtonState, ButtonState, ButtonState, ButtonState, ButtonState, int)
Initializes a new instance of the MouseState.
public MouseState(int x, int y, int scrollWheel, ButtonState leftButton, ButtonState middleButton, ButtonState rightButton, ButtonState xButton1, ButtonState xButton2, int horizontalScrollWheel)
Parameters
x
intHorizontal position of the mouse in relation to the window.
y
intVertical position of the mouse in relation to the window.
scrollWheel
intMouse scroll wheel's value.
leftButton
ButtonStateLeft mouse button's state.
middleButton
ButtonStateMiddle mouse button's state.
rightButton
ButtonStateRight mouse button's state.
xButton1
ButtonStateXBUTTON1's state.
xButton2
ButtonStateXBUTTON2's state.
horizontalScrollWheel
intMouse horizontal scroll wheel's value.
Remarks
Normally GetState() should be used to get mouse current state. The constructor is provided for simulating mouse input.
Properties
HorizontalScrollWheelValue
Returns the cumulative horizontal scroll wheel value since the game start
public int HorizontalScrollWheelValue { get; }
Property Value
LeftButton
Gets state of the left mouse button.
public ButtonState LeftButton { get; }
Property Value
MiddleButton
Gets state of the middle mouse button.
public ButtonState MiddleButton { get; }
Property Value
Position
Gets cursor position.
public Point Position { get; }
Property Value
RightButton
Gets state of the right mouse button.
public ButtonState RightButton { get; }
Property Value
ScrollWheelValue
Returns cumulative scroll wheel value since the game start.
public int ScrollWheelValue { get; }
Property Value
X
Gets horizontal position of the cursor in relation to the window.
public int X { get; }
Property Value
XButton1
Gets state of the XButton1.
public ButtonState XButton1 { get; }
Property Value
XButton2
Gets state of the XButton2.
public ButtonState XButton2 { get; }
Property Value
Y
Gets vertical position of the cursor in relation to the window.
public int Y { get; }
Property Value
Methods
Equals(object)
Compares whether current instance is equal to specified object.
public override bool Equals(object obj)
Parameters
obj
objectThe MouseState to compare.
Returns
GetHashCode()
Gets the hash code for MouseState instance.
public override int GetHashCode()
Returns
- int
Hash code of the object.
ToString()
Returns a string describing the mouse state.
public override string ToString()
Returns
Operators
operator ==(MouseState, MouseState)
Compares whether two MouseState instances are equal.
public static bool operator ==(MouseState left, MouseState right)
Parameters
left
MouseStateMouseState instance on the left of the equal sign.
right
MouseStateMouseState instance on the right of the equal sign.
Returns
- bool
true if the instances are equal; false otherwise.
operator !=(MouseState, MouseState)
Compares whether two MouseState instances are not equal.
public static bool operator !=(MouseState left, MouseState right)
Parameters
left
MouseStateMouseState instance on the left of the equal sign.
right
MouseStateMouseState instance on the right of the equal sign.
Returns
- bool
true if the objects are not equal; false otherwise.