Table of Contents

Class Mouse

Namespace
Microsoft.Xna.Framework.Input
Assembly
MonoGame.Framework.dll

Allows reading position and button click information from mouse.

public static class Mouse
Inheritance
Mouse
Inherited Members

Properties

WindowHandle

Gets or sets the window handle for current mouse processing.

public static nint WindowHandle { get; set; }

Property Value

nint

Methods

GetState()

Gets mouse state information that includes position and button presses for the primary window

public static MouseState GetState()

Returns

MouseState

Current state of the mouse.

GetState(GameWindow)

This API is an extension to XNA. Gets mouse state information that includes position and button presses for the provided window

public static MouseState GetState(GameWindow window)

Parameters

window GameWindow

Returns

MouseState

Current state of the mouse.

SetCursor(MouseCursor)

Sets the cursor image to the specified MouseCursor.

public static void SetCursor(MouseCursor cursor)

Parameters

cursor MouseCursor

Mouse cursor to use for the cursor image.

SetPosition(int, int)

Sets mouse cursor's relative position to game-window.

public static void SetPosition(int x, int y)

Parameters

x int

Relative horizontal position of the cursor.

y int

Relative vertical position of the cursor.