Skip to content

Custom Cursor Manager

Andrew Hernandez edited this page Jul 10, 2026 · 13 revisions

System Summary

The Custom Cursor Manager replaces the default mouse cursor with one that changes depending on states in the editor, as well as handling a selector frame on the tile the user's cursor hovers over.


Connected Systems

List of connecting/parent/subsystems.

Connecting Systems:

Bugs

  • None

Feature List / Breakdown of Features

List of features and descriptions within system.

Custom Cursor:

  • Visually reflects the user's current tool (Brush, Box Brush and Cursor)
  • Each icon has a variant with an X to indicate invalid placement.
  • Cursor tool is a hand which will point at editable entities and "grab" moving entities
  • Reverts to the cursor image when hovering on UI elements.
  • Takes Global State into account, if not in EDIT state -> mouse sprite is the basic cursor icon

Selector Frame:

  • Snaps to the cell the user hovers on at any time.
  • Changes appearance based on these states:
    • White: Default
    • Red: When deleting tiles
    • Yellow: When hovering over an entity with the cursor tool (to edit)
    • Cyan: When moving entities
    • Magenta: When copying entities
    • Invisible: When in a non-placeable area
  • A dashed version of this frame will appear on entities being edited. It will auto-hide when the property menu is not visible.

Important Variables

Name the most important variables, their type, and what their purpose is

  • customIcon : Texture2D = Example of a preloaded icon texture. (exists for all tools and invalid variants)

  • selectorFrame : Sprite2D = A frame indicator that highlights the cell the mouse hovers over.

  • entityHighlight : Sprite2D = An alternate selector frame that appears on an entity currently being edited.

  • selectorState : enum = Dictates the state of the selector frame.

  • currentMousePosition : Vector2 = Where the mouse is at any given time.

Important Functions

Name of the most important functions, their parameters, and what they do.

  • func _process(delta : float) -> void: Updates the positions and behaviors selector frame and custom cursor every frame.
  • func update_selector_state() -> void: Changes the state of the selector frame according to various conditions, such as erasing, moving or disappearing on invalid positions.
  • func highlight_selected_entity() -> void: Sets the position of the entity highlight sprite and displays it.

Future Work / Risks

Future Work:

  1. Make the selector frame appear red when deleting entities and using box deletion.
  2. Fix "cyan" state to enable when the hold timer reaches 0.

Risks:

  • Image loading is based on the file path in the res directory. Moving files could cause reference problems if this script isn't updated accordingly.

Miscellaneous Notes

A place for miscellaneous notes pertaining to this system.

  • None.

Clone this wiki locally