[go: up one dir, main page]

glfwCreateCursor

Function glfwCreateCursor 

Source
pub unsafe extern "C" fn glfwCreateCursor(
    image: *const GLFWimage,
    xhot: i32,
    yhot: i32,
) -> *mut GLFWcursor
Expand description

@brief Creates a custom cursor.

Creates a new custom cursor image that can be set for a window with @ref glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor. Any remaining cursors are destroyed by @ref glfwTerminate.

The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight bits per channel with the red channel first. They are arranged canonically as packed sequential rows, starting from the top-left corner.

The cursor hotspot is specified in pixels, relative to the upper-left corner of the cursor image. Like all other coordinate systems in GLFW, the X-axis points to the right and the Y-axis points down.

@param[in] image The desired cursor image. @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot. @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot. @return The handle of the created cursor, or NULL if an [error](@ref error_handling) occurred.

@errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.

@pointer_lifetime The specified image data is copied before this function returns.

@thread_safety This function must only be called from the main thread.

@sa @ref cursor_object @sa @ref glfwDestroyCursor @sa @ref glfwCreateStandardCursor

@since Added in version 3.1.

@ingroup input