ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. setCursorImage

Function

setCursorImage

ClientCursorTrilogy Hub only

Swaps the game cursor for your own image: a PNG file from the resource or a texture from dxCreateTexture or dxCreateRenderTarget. Calling it with no argument or with false returns to the built-in cursor.

Syntax

bool setCursorImage([string|texture|bool image = nil, int hotX = 0, int hotY = 0, int width, int height])

Arguments

imagestring|texture|bool, optional = nil
A file path, a texture or false.
hotXint, optional = 0
The click point in the image: pixels from the left edge.
hotYint, optional = 0
The click point: pixels from the top edge.
widthint, optional
On-screen width (the image width by default, up to 512).
heightint, optional
On-screen height (the image height by default, up to 512).

Returns

true on success.

Example

A 32x32 crosshair that clicks with its centre.

showCursor(true)
setCursorImage("img/celownik.png", 16, 16)

Notes

Pixels are copied at the moment of the call. A cursor drawn into a render target needs another call after every change. When the resource that set the image stops, the plain arrow returns.

See also