Cursor
Introduction
Cursor provides processed input values for detecting the cursor position, pushes, and clicks. Cursor is used internally by Gum to perform operations such as clicking on buttons or dragging sliders.
The Cursor abstracts mouse and touch screen input, so it can be used regardless of input hardware.
Accessing Cursor
Most runtimes create a Cursor internally.
The cursor can be accessed through GumService.
GumService.Default.Cursor was introduced in March 2025. Older versions of Gum can access the cursor through FormsUtilities.
WindowOver
WindowOver returns the current InteractiveGue that the Cursor is hovering over. This returns the visual that the user is over when using Forms controls.
A runtime instance is eligible for being the Cursor's WindowOver if its HasEvents variable is set to true, and if either of the following are true:
It is an instance of a Component
It is an instance of a Standard Element, but it has any cursor-related events assigned such as Push or Click.
For example, a Sprite may be considered WindowOver if it has a Click event assigned.
Code Example - Preventing Click-Throughs
The WindowOver property can be used to detect if clicks should be consumed or passed down to your game. For example, you may have a HUD which displays buttons. If the user Cursor is over the HUD then the game should not process input.
The following code shows how to check if the user is over Gum UI.
WindowPushed
WindowPushed returns the InteractiveGue (Forms Visual) which was under the Cursor when its PrimaryPush was set to true. WindowPushed can be used to handle drag+drop operations.
For example, consider a game which allows the user to purchase items. The user can push and drag an item onto a container to buy the item. The following code shows how that might be performed:
Last updated
Was this helpful?