Loading...
Searching...
No Matches
Cursor.h File Reference

Go to the source code of this file.

Enumerations

enum  sfCursorType {
  sfCursorArrow , sfCursorArrowWait , sfCursorWait , sfCursorText ,
  sfCursorHand , sfCursorSizeHorizontal , sfCursorSizeVertical , sfCursorSizeTopLeftBottomRight ,
  sfCursorSizeBottomLeftTopRight , sfCursorSizeLeft , sfCursorSizeRight , sfCursorSizeTop ,
  sfCursorSizeBottom , sfCursorSizeTopLeft , sfCursorSizeBottomRight , sfCursorSizeBottomLeft ,
  sfCursorSizeTopRight , sfCursorSizeAll , sfCursorCross , sfCursorHelp ,
  sfCursorNotAllowed
}
 Enumeration of the native system cursor types. More...
 

Functions

sfCursorsfCursor_createFromPixels (const sfUint8 *pixels, sfVector2u size, sfVector2u hotspot)
 Create a cursor with the provided image.
 
sfCursorsfCursor_createFromSystem (sfCursorType type)
 Create a native system cursor.
 
void sfCursor_destroy (sfCursor *cursor)
 Destroy a cursor.
 

Enumeration Type Documentation

◆ 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
Enumerator
sfCursorArrow 

Arrow cursor (default)

sfCursorArrowWait 

Busy arrow cursor.

sfCursorWait 

Busy cursor.

sfCursorText 

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

sfCursorHand 

Pointing hand cursor.

sfCursorSizeHorizontal 

Horizontal double arrow cursor.

sfCursorSizeVertical 

Vertical double arrow cursor.

sfCursorSizeTopLeftBottomRight 

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

sfCursorSizeBottomLeftTopRight 

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

sfCursorSizeLeft 

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

sfCursorSizeRight 

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

sfCursorSizeTop 

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

sfCursorSizeBottom 

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

sfCursorSizeTopLeft 

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

sfCursorSizeBottomRight 

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

sfCursorSizeBottomLeft 

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

sfCursorSizeTopRight 

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

sfCursorSizeAll 

Combination of SizeHorizontal and SizeVertical.

sfCursorCross 

Crosshair cursor.

sfCursorHelp 

Help cursor.

sfCursorNotAllowed 

Action not allowed cursor.

Definition at line 67 of file Cursor.h.

Function Documentation

◆ sfCursor_createFromPixels()

sfCursor * sfCursor_createFromPixels ( const sfUint8 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 current cursor is left unchanged and the function will return false.

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
pixelsArray of pixels of the image
sizeWidth and height of the image
hotspot(x,y) location of the hotspot
Returns
A new sfCursor object

◆ sfCursor_createFromSystem()

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
typeNative system cursor type
Returns
A new sfCursor object

◆ sfCursor_destroy()

void sfCursor_destroy ( sfCursor cursor)

Destroy a cursor.

Parameters
cursorCursor to destroy