MouseStateExtensions

class MouseStateExtensions : System.Object

Extensions for the XNA T:Microsoft.Xna.Framework.Input.MouseState class.

This provides state-aware functions for detecting changes in the mouse state, without having to track the previous state in each object that wants to know about button presses.

public System.Nullable<ButtonState> LeftChanged(MouseState state, System.Object obj)

Detects whether or not the left mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • obj (System.Object) – The object for the unique check to be done against.
Returns:

The state change of the left mouse button, or null if there’s no change.

public System.Nullable<ButtonState> LeftChanged(MouseState state, int hash)

Detects whether or not the left mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • hash (int) – The unique hash code for the unique check to be done against.
Returns:

The state change of the left mouse button, or null if there’s no change.

public System.Nullable<ButtonState> MiddleChanged(MouseState state, System.Object obj)

Detects whether or not the middle mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • obj (System.Object) – The object for the unique check to be done against.
Returns:

The state change of the middle mouse button, or null if there’s no change.

public System.Nullable<ButtonState> MiddleChanged(MouseState state, int hash)

Detects whether or not the middle mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • hash (int) – The unique hash code for the unique check to be done against.
Returns:

The state change of the middle mouse button, or null if there’s no change.

public System.Nullable<ButtonState> RightChanged(MouseState state, System.Object obj)

Detects whether or not the right mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • obj (System.Object) – The object for the unique check to be done against.
Returns:

The state change of the right mouse button, or null if there’s no change.

public System.Nullable<ButtonState> RightChanged(MouseState state, int hash)

Detects whether or not the right mouse button has changed state.

Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) – The mouse state to check.
  • hash (int) – The unique hash code for the unique check to be done against.
Returns:

The state change of the right mouse button, or null if there’s no change.

public bool LeftPressed(MouseState state, System.Object obj)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • obj (System.Object) –
public bool LeftPressed(MouseState state, int hash)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • hash (int) –
public bool MiddlePressed(MouseState state, System.Object obj)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • obj (System.Object) –
public bool MiddlePressed(MouseState state, int hash)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • hash (int) –
public bool RightPressed(MouseState state, System.Object obj)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • obj (System.Object) –
public bool RightPressed(MouseState state, int hash)
Parameters:
  • state (Microsoft.Xna.Framework.Input.MouseState) –
  • hash (int) –