Skip to main content

SDL_CreateColorCursor

Function SDL_CreateColorCursor 

Source
pub unsafe extern "C" fn SDL_CreateColorCursor(
    surface: *mut SDL_Surface,
    hot_x: c_int,
    hot_y: c_int,
) -> *mut SDL_Cursor
Expand description

Create a color cursor.

If this function is passed a surface with alternate representations added with SDL_AddSurfaceAlternateImage(), 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.

Parameter: surface an SDL_Surface structure representing the cursor image. Parameter: hot_x the x position of the cursor hot spot. Parameter: hot_y the y position of the cursor hot spot. Returns: the new cursor on success or NULL on failure; call SDL_GetError() for more information.

Thread Safety: This function should only be called on the main thread.

Available Since: This function is available since SDL 3.2.0.

See Also: SDL_AddSurfaceAlternateImage See Also: SDL_CreateAnimatedCursor See Also: SDL_CreateCursor See Also: SDL_CreateSystemCursor See Also: SDL_DestroyCursor See Also: SDL_SetCursor