Cursor

Enums

enum sfCursorType

Enumeration of the native system cursor types.

Refer to the following table to determine which cursor is available on which platform.

Type

Linux

Mac OS X

Windows

sfCursorArrow

yes

yes

yes

sfCursorArrowWait

no

no

yes

sfCursorWait

yes

no

yes

sfCursorText

yes

yes

yes

sfCursorHand

yes

yes

yes

sfCursorSizeHorizontal

yes

yes

yes

sfCursorSizeVertical

yes

yes

yes

sfCursorSizeTopLeftBottomRight

no

no

yes

sfCursorSizeBottomLeftTopRight

no

no

yes

sfCursorSizeLeft

yes

yes

yes

sfCursorSizeRight

yes

yes

yes

sfCursorSizeTop

yes

yes

yes

sfCursorSizeBottom

yes

yes

yes

sfCursorSizeTopLeft

yes

yes

yes

sfCursorSizeTopRight

yes

yes

yes

sfCursorSizeBottomLeft

yes

yes

yes

sfCursorSizeBottomRight

yes

yes

yes

sfCursorSizeAll

yes

no

yes

sfCursorCross

yes

yes

yes

sfCursorHelp

yes

no

yes

sfCursorNotAllowed

yes

yes

yes

Values:

enumerator sfCursorArrow

Arrow cursor (default)

enumerator sfCursorArrowWait

Busy arrow cursor.

enumerator sfCursorWait

Busy cursor.

enumerator sfCursorText

I-beam, cursor when hovering over a field allowing text entry.

enumerator sfCursorHand

Pointing hand cursor.

enumerator sfCursorSizeHorizontal

Horizontal double arrow cursor.

enumerator sfCursorSizeVertical

Vertical double arrow cursor.

enumerator sfCursorSizeTopLeftBottomRight

Double arrow cursor going from top-left to bottom-right.

enumerator sfCursorSizeBottomLeftTopRight

Double arrow cursor going from bottom-left to top-right.

enumerator sfCursorSizeLeft

Left arrow cursor on Linux, same as SizeHorizontal on other platforms.

enumerator sfCursorSizeRight

Right arrow cursor on Linux, same as SizeHorizontal on other platforms.

enumerator sfCursorSizeTop

Up arrow cursor on Linux, same as SizeVertical on other platforms.

enumerator sfCursorSizeBottom

Down arrow cursor on Linux, same as SizeVertical on other platforms.

enumerator sfCursorSizeTopLeft

Top-left arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms.

enumerator sfCursorSizeBottomRight

Bottom-right arrow cursor on Linux, same as SizeTopLeftBottomRight on other platforms.

enumerator sfCursorSizeBottomLeft

Bottom-left arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms.

enumerator sfCursorSizeTopRight

Top-right arrow cursor on Linux, same as SizeBottomLeftTopRight on other platforms.

enumerator sfCursorSizeAll

Combination of SizeHorizontal and SizeVertical.

enumerator sfCursorCross

Crosshair cursor.

enumerator sfCursorHelp

Help cursor.

enumerator sfCursorNotAllowed

Action not allowed cursor.

Functions

sfCursor *sfCursor_createFromPixels(const uint8_t *pixels, sfVector2u size, sfVector2u hotspot)

Create a cursor with the provided image.

pixels must be an array of width by height pixels in 32-bit RGBA format. If not, this will cause undefined behavior.

If pixels is null or either width or height are 0, the function will return no new cursor (nullptr).

In addition to specifying the pixel data, you can also specify the location of the hotspot of the cursor. The hotspot is the pixel coordinate within the cursor image which will be located exactly where the mouse pointer position is. Any mouse actions that are performed will return the window/screen location of the hotspot.

Warning

On Unix, the pixels are mapped into a monochrome bitmap: pixels with an alpha channel to 0 are transparent, black if the RGB channel are close to zero, and white otherwise.

Parameters:
  • pixels – Array of pixels of the image

  • size – Width and height of the image

  • hotspot – (x,y) location of the hotspot

Returns:

A new sfCursor object

sfCursor *sfCursor_createFromSystem(sfCursorType type)

Create a native system cursor.

Refer to the list of cursor available on each system (see sfCursorType) to know whether a given cursor is expected to load successfully or is not supported by the operating system.

Parameters:
  • type – Native system cursor type

Returns:

A new sfCursor object

void sfCursor_destroy(const sfCursor *cursor)

Destroy a cursor.

Parameters:
  • cursor – Cursor to destroy