mask has to be in MSB (Most Significant Bit) format.
The cursor width (w) must be a multiple of 8 bits.
The cursor is created in black and white according to the following:
- data=0, mask=1: white
- data=1, mask=1: black
- data=0, mask=0: transparent
- data=1, mask=0: inverted color if possible, black if not.
Cursors created with this function must be freed with Cursor.Destroy().
If you want to have a color cursor, or create your cursor from an Surface, you should use Cursor.Cursor(). Alternately, you can hide the cursor and draw your own as part of your game's rendering, but it will be bound to the framerate.
Also, Cursor.Cursor() is available, which provides several readily-available system cursors to pick from.
- Parameters
-
| data | the color value for each pixel of the cursor. |
| mask | the mask value for each pixel of the cursor. |
| size | the width and height of the cursor. |
| hot | the x position of the cursor hot spot, from the top-left, in the range of 0 to size.x - 1 and 0 to size.y - 1. |
- Postcondition
- a new cursor with the specified parameters on success.
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- CreateAnimatedCursor
-
Cursor.Cursor
-
Cursor.Cursor
-
Cursor.Destroy
-
Cursor.Set
If this function is passed a surface with alternate representations added with Surface.AddAlternateImage(), the surface will be interpreted as the content to be used for 100% display scale, and the alternate representations will be used for high DPI situations if SDL_HINT_MOUSE_DPI_SCALE_CURSORS is enabled. For example, if the original surface is 32x32, then on a 2x macOS display or 200% display scale on Windows, a 64x64 version of the image will be used, if available. If a matching version of the image isn't available, the closest larger size image will be downscaled to the appropriate size and be used instead, if available. Otherwise, the closest smaller image will be upscaled and be used instead.
- Parameters
-
| surface | an Surface structure representing the cursor image. |
| hot | the x, y position of the cursor hot spot. |
- Postcondition
- the new cursor on success.
- Exceptions
-
- Thread safety:
- This function should only be called on the main thread.
- Since
- This function is available since SDL 3.2.0.
- See also
- Surface.AddAlternateImage
-
CreateAnimatedCursor
-
Cursor.Cursor
-
Cursor.Cursor
-
Cursor.Destroy
-
Cursor.Set