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 | |
sfCursor * | sfCursor_createFromPixels (const uint8_t *pixels, sfVector2u size, sfVector2u hotspot) |
Create a cursor with the provided image. | |
sfCursor * | sfCursor_createFromSystem (sfCursorType type) |
Create a native system cursor. | |
void | sfCursor_destroy (const sfCursor *cursor) |
Destroy a cursor. | |
Enumeration Type Documentation
◆ sfCursorType
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 |
Function Documentation
◆ sfCursor_createFromPixels()
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_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
-
type Native system cursor type
- Returns
- A new sfCursor object
◆ sfCursor_destroy()
void sfCursor_destroy | ( | const sfCursor * | cursor | ) |
Destroy a cursor.
- Parameters
-
cursor Cursor to destroy