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
HeldButtons
Gets a collection of all buttons which are held this frame.
public static IEnumerable<MouseButton> HeldButtons { get; }
Property Value
Position
The position of the mouse.
public static Vector2 Position { get; set; }
Property Value
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
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
ScrollWheelDelta
The distance the scroll whell has moved since the last frame.
public static float ScrollWheelDelta { get; }
Property Value
Visible
Whether the cursor is visible or not.
public static bool Visible { get; set; }
Property Value
Methods
IsButtonDown(MouseButton)
public static bool IsButtonDown(MouseButton button)
Parameters
button
MouseButton
Returns
IsButtonPressed(MouseButton)
public static bool IsButtonPressed(MouseButton button)
Parameters
button
MouseButton
Returns
IsButtonReleased(MouseButton)
public static bool IsButtonReleased(MouseButton button)
Parameters
button
MouseButton
Returns
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
AlignmentThe 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
intThe X position of the cursor's center, relative to the top-left corner of the image.
anchorY
intThe 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
ITextureThe image to set the mouse cursor to.
anchor
AlignmentThe 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
ITextureThe image to set the mouse cursor to.
anchorX
intThe X position of the cursor's center, relative to the top-left corner of the image.
anchorY
intThe 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
SystemCursorThe 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
intThe width of the cursor image, in pixels.
height
intThe height of the cursor image, in pixels.
anchor
AlignmentThe 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
intThe width of the cursor image, in pixels.
height
intThe height of the cursor image, in pixels.
anchorX
intThe X position of the cursor's center, relative to the top-left corner of the image.
anchorY
intThe 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
ButtonUp
Fired when the user released a mouse button.
public static event MouseButtonEvent ButtonUp