class Cursor

Inherits: Module<Cursor>

Allows you to manipulate the platform cursor in various ways.

Public

Constructors

Cursor

Cursor()

Methods

SetScreenPosition

void SetScreenPosition(const GUIPhysicalPoint &screenPos)

Moves the cursor to the specified screen position.

GetScreenPosition

GUIPhysicalPoint GetScreenPosition() const

Retrieves the cursor position in screen coordinates.

Hide

void Hide()

Hides the cursor.

Show

void Show()

Shows the cursor.

ClipToWindow

void ClipToWindow(const RenderWindow &window)

Limit cursor movement to the specified window.

ClipToRect

void ClipToRect(const Area2I &screenRect)

Limit cursor movement to specific area on the screen.

ClipDisable

void ClipDisable()

Disables cursor clipping that was set using any of the clipTo* methods.

SetCursor

void SetCursor(CursorType type)

Sets a cursor icon.

Uses one of the built-in cursor types.

SetCursor

void SetCursor(const String &name)

Sets a cursor icon.

Uses one of the manually registered icons.

name
The name to identify the cursor, one set previously by calling setCursorIcon().

SetCursorIcon

void SetCursorIcon(const String &name, const PixelData &pixelData, const Vector2I &hotSpot)

Registers a new custom cursor icon you can then set by calling "setCursor".

name
The name to identify the cursor.
pixelData
Cursor image data.
hotSpot
Offset on the cursor image to where the actual input happens (for example tip of the Arrow cursor).

SetCursorIcon

void SetCursorIcon(CursorType type, const PixelData &pixelData, const Vector2I &hotSpot)

Registers a new custom cursor icon you can then set by calling setCursor().

type
One of the built-in cursor types.
pixelData
Cursor image data.
hotSpot
Offset on the cursor image to where the actual input happens (for example tip of the Arrow cursor).

ClearCursorIcon

void ClearCursorIcon(const String &name)

Removes a custom cursor icon and releases any data associated with it.

ClearCursorIcon

void ClearCursorIcon(CursorType type)

Removes a custom cursor icon and releases any data associated with it.

Restores original icon associated with this cursor type.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnStartUp

virtual void OnStartUp()

Override if you want your module to be notified once it has been constructed and started.

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Private

Methods

RestoreCursorIcon

void RestoreCursorIcon(CursorType type)

Restores the default cursor icon for the specified cursor type.

UpdateCursorImage

void UpdateCursorImage()

Sends the cursor image to the OS, making it active.

Fields

mCustomIconNameToId

UnorderedMap<String, u32> mCustomIconNameToId

mCustomIcons

UnorderedMap<u32, CustomIcon> mCustomIcons

mNextUniqueId

u32 mNextUniqueId

mActiveCursorId

i32 mActiveCursorId