Table of Contents

Class Mouse

Namespace
SimulationFramework.Input
Assembly
SimulationFramework.dll

Provides mouse input to the application.

public static class Mouse
Inheritance
Mouse
Inherited Members

Properties

DeltaPosition

The distance the mouse has moved since the last frame.

Note: this value may not be accurate if the window was moved or resized.

public static Vector2 DeltaPosition { get; }

Property Value

Vector2

HeldButtons

Gets a collection of all buttons which are held this frame.

public static IEnumerable<MouseButton> HeldButtons { get; }

Property Value

IEnumerable<MouseButton>

Position

The position of the mouse.

public static Vector2 Position { get; set; }

Property Value

Vector2

PressedButtons

Gets a collection of all buttons pressed this frame. A key is only considered pressed on the first frame that it is held.

public static IEnumerable<MouseButton> PressedButtons { get; }

Property Value

IEnumerable<MouseButton>

ReleasedButtons

Gets a collection of all buttons released this frame. A key is only considered released on the first frame that it is not held.

public static IEnumerable<MouseButton> ReleasedButtons { get; }

Property Value

IEnumerable<MouseButton>

ScrollWheelDelta

The distance the scroll whell has moved since the last frame.

public static float ScrollWheelDelta { get; }

Property Value

float

Visible

Whether the cursor is visible or not.

public static bool Visible { get; set; }

Property Value

bool

Methods

IsButtonDown(MouseButton)

Returns true if the provided button is down; otherwise false.

public static bool IsButtonDown(MouseButton button)

Parameters

button MouseButton

Returns

bool

IsButtonPressed(MouseButton)

Returns true if the provided button was just pressed this frame; otherwise false.

public static bool IsButtonPressed(MouseButton button)

Parameters

button MouseButton

Returns

bool

IsButtonReleased(MouseButton)

Returns true if the provided button was just released this frame; otherwise false.

public static bool IsButtonReleased(MouseButton button)

Parameters

button MouseButton

Returns

bool

SetCursor(Color[,], Alignment)

Sets the mouse cursor to a custom image.

public static void SetCursor(Color[,] colors, Alignment anchor)

Parameters

colors Color[,]

The image to set the mouse cursor to.

anchor Alignment

The location of the cursor's center.

SetCursor(Color[,], int, int)

Sets the mouse cursor to a custom image.

public static void SetCursor(Color[,] colors, int anchorX = 0, int anchorY = 0)

Parameters

colors Color[,]

The image to set the mouse cursor to.

anchorX int

The X position of the cursor's center, relative to the top-left corner of the image.

anchorY int

The Y position of the cursor's center, relative to the top-left corner of the image.

SetCursor(ITexture, Alignment)

Sets the mouse cursor to a custom image.

public static void SetCursor(ITexture texture, Alignment anchor)

Parameters

texture ITexture

The image to set the mouse cursor to.

anchor Alignment

The location of the cursor's center.

SetCursor(ITexture, int, int)

Sets the mouse cursor to a custom image.

public static void SetCursor(ITexture texture, int anchorX = 0, int anchorY = 0)

Parameters

texture ITexture

The image to set the mouse cursor to.

anchorX int

The X position of the cursor's center, relative to the top-left corner of the image.

anchorY int

The Y position of the cursor's center, relative to the top-left corner of the image.

SetCursor(SystemCursor)

Sets the mouse cursor to a system cursor.

public static void SetCursor(SystemCursor cursor)

Parameters

cursor SystemCursor

The system cursor to set the mouse cursor to.

SetCursor(ReadOnlySpan<Color>, int, int, Alignment)

Sets the mouse cursor to a custom image.

public static void SetCursor(ReadOnlySpan<Color> colors, int width, int height, Alignment anchor)

Parameters

colors ReadOnlySpan<Color>

A ReadOnlySpan<T> of Color containing the cursor image data. Must be of size width * height.

width int

The width of the cursor image, in pixels.

height int

The height of the cursor image, in pixels.

anchor Alignment

The location of the cursor's center.

SetCursor(ReadOnlySpan<Color>, int, int, int, int)

Sets the mouse cursor to a custom image.

public static void SetCursor(ReadOnlySpan<Color> colors, int width, int height, int anchorX = 0, int anchorY = 0)

Parameters

colors ReadOnlySpan<Color>

A ReadOnlySpan<T> of Color containing the cursor image data. Must be of size width * height.

width int

The width of the cursor image, in pixels.

height int

The height of the cursor image, in pixels.

anchorX int

The X position of the cursor's center, relative to the top-left corner of the image.

anchorY int

The Y position of the cursor's center, relative to the top-left corner of the image.

Events

ButtonDown

Fired when the user presses a mouse button.

public static event MouseButtonEvent ButtonDown

Event Type

MouseButtonEvent

ButtonUp

Fired when the user released a mouse button.

public static event MouseButtonEvent ButtonUp

Event Type

MouseButtonEvent