glfwCreateCursor

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.

extern (C) @nogc nothrow __gshared
glfwCreateCursor
(,
int xhot
,
int yhot
)

Parameters

image const(GLFWimage)*

The desired cursor image.

xhot int

The desired x-coordinate, in pixels, of the cursor hotspot.

yhot int

The desired y-coordinate, in pixels, of the cursor hotspot.

Return Value

Type: GLFWcursor*

The handle of the created cursor, or null if an error occurred.

Errors: Possible errors include @ref GLFW_NOT_INITIALIZED 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

Meta

Since

Added in version 3.1.

Ingroup: input