Skip to content

Custom Cursor Manager

Andrew Hernandez edited this page Jun 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)
  • Displays an X if the user is unable to place an object in the current cell.
  • Reverts to the cursor image when hovering on UI elements.

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
    • Invisible: When in a non-placeable area

Important Variables

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

  • invalidSprite : Sprite2D = An X icon that appears when hovering over an unplaceable area.
  • selectorFrame : Sprite2D = A frame indicator that highlights the cell the mouse hovers over.
  • 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.


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