Mouseclass

Access to mouse position, movement, input mode and cursor appearance.

object→Mouse
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public static abstract sealed class Sandbox.Mouse

Properties7

Showing 7 properties

public static bool Sandbox.Mouse.Active { get; set; }PUBLICSTATICGETSET

Whether the cursor can interact with UI. Can be true even when `Sandbox.Mouse.CursorType` is `"none"`.

Returns:bool—

public static string Sandbox.Mouse.CursorType { get; set; }PUBLICSTATICGETSET

Sets the cursor image. UI hover cursors can overwrite or reset this value. Use `"none"` to hide the image without changing input mode or pointer speed.

Returns:string—

public static Vector2 Sandbox.Mouse.Delta { get; set; }PUBLICSTATICGETSET

Mouse movement since the last frame. Captured input normally bypasses OS pointer speed and acceleration. Unaffected by `Sandbox.Preferences.Sensitivity`, which scales `Sandbox.Input.AnalogLook`.

Returns:Vector2—

public static Vector2 Sandbox.Mouse.Position { get; set; }PUBLICSTATICGETSET

The local client's cursor position, in pixels relative to the game window's top-left corner. In captured mode, accumulates relative movement instead of tracking the OS cursor.

Returns:Vector2—

public static Sandbox.MouseVisibility Sandbox.Mouse.Visibility { get; set; }PUBLICSTATICGETSET

Controls cursor interaction and capture. `Sandbox.MouseVisibility.Hidden` uses relative input, which normally bypasses OS pointer speed and acceleration. For a game-drawn cursor with OS pointer speed, use `Sandbox.MouseVisibility.Visible` with `Mouse.CursorType = "none"` and draw at `Sandbox.Mouse.Position`.

Returns:MouseVisibility—

public static bool Sandbox.Mouse.Visible { get; set; }PUBLICSTATICGETSETOBSOLETE

DEPRECATED. Use Mouse.Visibility instead.

Obsolete: This API member is obsolete.

Returns:bool—

On this page