cursor-shapes.dhover×187all
#!/usr/bin/env dub
/+ dub.sdl:
    name "cursor-shapes"
    description "Hover/click tiles to exercise raylib SetMouseCursor / GLFW standard shapes"
    targetType "executable"
    targetPath "build"
    dependency "raylib-d" version="~>6.0.1"
    libs "raylib"
+/
/// Click / hover the tiles to ask raylib (`SetMouseCursor`) for each standard
/// pointer shape. Stock GLFW 3.5.1 fails most of these on GNOME/Adwaita;
/// the sparkles glfw overlay (wp_cursor_shape_v1) is what makes them work.
/// See index.md.
module 
(module) cursor_shapes

Click / hover the tiles to ask raylib (SetMouseCursor) for each standard pointer shape. Stock GLFW 3.5.1 fails most of these on GNOME/Adwaita; the sparkles glfw overlay (wp_cursor_shape_v1) is what makes them work. See index.md.

cursor_shapes
;
import
(module) raylib

raylib v6.0 - A simple and easy-to-use library to enjoy videogames programming (www.raylib.com)

FEATURES

  • NO external dependencies, all required libraries included with raylib

  • Multiplatform: Windows, Linux, macOS, FreeBSD, Web, Android, Raspberry Pi, DRM native...

  • Written in plain C code (C99) in PascalCase/camelCase notation

  • Hardware accelerated with OpenGL (1.1, 2.1, 3.3, 4.3, ES2, ES3 - choose at compile)

  • Software renderer optional, for systems with no GPU: rlsw

  • Custom OpenGL abstraction layer (usable as standalone module): rlgl

  • Multiple Fonts formats supported (TTF, OTF, FNT, BDF, Sprite fonts)

  • Many texture formats supported, including compressed formats (DXT, ETC, ASTC)

  • Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!

  • Flexible Materials system, supporting classic maps and PBR maps

  • Animated 3D models supported (skeletal bones animation) (IQM, M3D, GLTF)

  • Shaders support, including Model shaders and Postprocessing shaders

  • Powerful math module for Vector, Matrix and Quaternion operations: raymath

  • Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, QOA, XM, MOD)

  • VR stereo rendering with configurable HMD device parameters

  • Bindings to multiple programming languages available!

NOTES

  • One default Font is loaded on InitWindow()->LoadFontDefault() core, text

  • One default Texture2D is loaded on rlglInit(), 1x1 white pixel R8G8B8A8 rlgl (OpenGL 3.3 or ES2)

  • One default Shader is loaded on rlglInit()->rlLoadShaderDefault() rlgl (OpenGL 3.3 or ES2)

  • One default RenderBatch is loaded on rlglInit()->rlLoadRenderBatch() rlgl (OpenGL 3.3 or ES2)

DEPENDENCIES

rcore Depends on the selected platform backend, check rcore.c header for details rlgl glad/glad_gles2 (David Herberth - github.com/Dav1dde/glad) for OpenGL extensions loading raudio miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management

OPTIONAL DEPENDENCIES (included): rcore sinfl (Micha Mettke) for DEFLATE decompression algorithm rcore sdefl (Micha Mettke) for DEFLATE compression algorithm rcore rprand (Ramon Santamaria) for pseudo-random numbers generation rtextures qoi (Dominic Szablewski - https://phoboslab.org) for QOI image management rtextures stb_image (Sean Barrett) for images loading (BMP, TGA, PNG, JPEG, HDR...) rtextures stb_image_write (Sean Barrett) for image writing (BMP, TGA, PNG, JPG) rtextures stb_image_resize2 (Sean Barrett) for image resizing algorithms rtextures stb_perlin (Sean Barrett) for Perlin Noise image generation rtextures rltexgpu (Ramon Santamaria) for GPU-compressed texture formats rtext stb_truetype (Sean Barrett) for ttf fonts loading rtext stb_rect_pack (Sean Barrett) for rectangles packing rmodels par_shapes (Philip Rideout) for parametric 3d shapes generation rmodels tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL) rmodels cgltf (Johannes Kuhlmann) for models loading (glTF) rmodels m3d (bzt) for models loading (M3D, https://bztsrc.gitlab.io/model3d) rmodels vox_loader (Johann Nadalutti) for models loading (VOX) raudio dr_wav (David Reid) for WAV audio file loading raudio dr_flac (David Reid) for FLAC audio file loading raudio dr_mp3 (David Reid) for MP3 audio file loading raudio stb_vorbis (Sean Barrett) for OGG audio loading raudio jar_xm (Joshua Reisenauer) for XM audio module loading raudio jar_mod (Joshua Reisenauer) for MOD audio module loading raudio qoa (Dominic Szablewski - https://phoboslab.org) for QOA audio management

@license

zlib/libpng

raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software:

Copyright (c) 2013-2026 Ramon Santamaria (@raysan5)

This software is provided "as-is", without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you

wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.

  1. Altered source versions must be plainly marked as such, and must not be misrepresented

as being the original software.

  1. This notice may not be removed or altered from any source distribution.

raylib
;
struct
(struct) cursor_shapes.Tile
Tile
{ const(char)*
(field) const(char)* cursor_shapes.Tile.label
label
;
(enum) raylib.MouseCursor
MouseCursor
(field) raylib.MouseCursor cursor_shapes.Tile.cursor
cursor
;
} void
void D main()
main
()
{
void raylib.SetTraceLogLevel(int logLevel) nothrow @nogc
SetTraceLogLevel
(
(enum) raylib.TraceLogLevel
TraceLogLevel
.
(enum value) raylib.TraceLogLevel.LOG_WARNING = 4
LOG_WARNING
);
void raylib.SetConfigFlags(uint flags) nothrow @nogc
SetConfigFlags
(
(enum) raylib.ConfigFlags
ConfigFlags
.
(enum value) raylib.ConfigFlags.FLAG_WINDOW_RESIZABLE = 4
FLAG_WINDOW_RESIZABLE
);
void raylib.InitWindow(int width, int height, const(char)* title) nothrow @nogc
InitWindow
(720, 520, "raylib pointer-shape probe");
void raylib.SetTargetFPS(int fps) nothrow @nogc
SetTargetFPS
(60);
static immutable
(struct) cursor_shapes.Tile
Tile
[]
(immutable global) immutable(cursor_shapes.Tile[]) cursor_shapes.main.tiles
tiles
= [
(struct) cursor_shapes.Tile
Tile
("DEFAULT",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_DEFAULT = 0
MOUSE_CURSOR_DEFAULT
),
(struct) cursor_shapes.Tile
Tile
("ARROW",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_ARROW = 1
MOUSE_CURSOR_ARROW
),
(struct) cursor_shapes.Tile
Tile
("IBEAM",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_IBEAM = 2
MOUSE_CURSOR_IBEAM
),
(struct) cursor_shapes.Tile
Tile
("CROSSHAIR",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_CROSSHAIR = 3
MOUSE_CURSOR_CROSSHAIR
),
(struct) cursor_shapes.Tile
Tile
("POINTING_HAND",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_POINTING_HAND = 4
MOUSE_CURSOR_POINTING_HAND
),
(struct) cursor_shapes.Tile
Tile
("RESIZE_EW",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_RESIZE_EW = 5
MOUSE_CURSOR_RESIZE_EW
),
(struct) cursor_shapes.Tile
Tile
("RESIZE_NS",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_RESIZE_NS = 6
MOUSE_CURSOR_RESIZE_NS
),
(struct) cursor_shapes.Tile
Tile
("RESIZE_NWSE",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_RESIZE_NWSE = 7
MOUSE_CURSOR_RESIZE_NWSE
),
(struct) cursor_shapes.Tile
Tile
("RESIZE_NESW",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_RESIZE_NESW = 8
MOUSE_CURSOR_RESIZE_NESW
),
(struct) cursor_shapes.Tile
Tile
("RESIZE_ALL",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_RESIZE_ALL = 9
MOUSE_CURSOR_RESIZE_ALL
),
(struct) cursor_shapes.Tile
Tile
("NOT_ALLOWED",
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_NOT_ALLOWED = 10
MOUSE_CURSOR_NOT_ALLOWED
),
];
(enum) raylib.MouseCursor
MouseCursor
(local variable) raylib.MouseCursor current
current
=
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_DEFAULT = 0
MOUSE_CURSOR_DEFAULT
;
const(char)*
(local variable) const(char)* currentName
currentName
= "DEFAULT";
while (!
bool raylib.WindowShouldClose() nothrow @nogc
WindowShouldClose
())
{ const
(local variable) const(raylib.raylib_types.Vector2) mouse
mouse
=
raylib.raylib_types.Vector2 raylib.GetMousePosition() nothrow @nogc
GetMousePosition
();
const
(local variable) const(int) cols
cols
= 3;
const
(local variable) const(int) margin
margin
= 16;
const
(local variable) const(int) gap
gap
= 10;
const
(local variable) const(int) header
header
= 88;
const
(local variable) const(int) tw
tw
= (
int raylib.GetScreenWidth() nothrow @nogc
GetScreenWidth
() -
(local variable) const(int) margin
margin
* 2 -
(local variable) const(int) gap
gap
* (
(local variable) const(int) cols
cols
- 1)) /
(local variable) const(int) cols
cols
;
const
(local variable) const(int) th
th
= 56;
bool
(local variable) bool overAny
overAny
;
foreach (
(parameter) ulong i
i
,
(parameter) immutable(cursor_shapes.Tile) tile
tile
;
(immutable global) immutable(cursor_shapes.Tile[]) cursor_shapes.main.tiles
tiles
)
{ const
(local variable) const(int) col
col
= cast(int)(
(local variable) ulong i
i
%
(local variable) const(int) cols
cols
);
const
(local variable) const(int) row
row
= cast(int)(
(local variable) ulong i
i
/
(local variable) const(int) cols
cols
);
const
(local variable) const(raylib.raylib_types.Rectangle) r
r
=
(struct) raylib.raylib_types.Rectangle
Rectangle
(
(local variable) const(int) margin
margin
+
(local variable) const(int) col
col
* (
(local variable) const(int) tw
tw
+
(local variable) const(int) gap
gap
),
(local variable) const(int) header
header
+
(local variable) const(int) row
row
* (
(local variable) const(int) th
th
+
(local variable) const(int) gap
gap
),
(local variable) const(int) tw
tw
,
(local variable) const(int) th
th
);
const
(local variable) const(bool) hot
hot
=
bool raylib.CheckCollisionPointRec(raylib.raylib_types.Vector2 point, raylib.raylib_types.Rectangle rec) nothrow @nogc
CheckCollisionPointRec
(
(local variable) const(raylib.raylib_types.Vector2) mouse
mouse
,
(local variable) const(raylib.raylib_types.Rectangle) r
r
);
if (
(local variable) const(bool) hot
hot
)
{
(local variable) bool overAny
overAny
= true;
(local variable) raylib.MouseCursor current
current
=
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) raylib.MouseCursor cursor_shapes.Tile.cursor
cursor
;
(local variable) const(char)* currentName
currentName
=
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) const(char)* cursor_shapes.Tile.label
label
;
if (
bool raylib.IsMouseButtonPressed(int button) nothrow @nogc
IsMouseButtonPressed
(
(enum) raylib.MouseButton
MouseButton
.
(enum value) raylib.MouseButton.MOUSE_BUTTON_LEFT = 0
MOUSE_BUTTON_LEFT
))
(local variable) const(char)* currentName
currentName
=
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) const(char)* cursor_shapes.Tile.label
label
;
} } if (!
(local variable) bool overAny
overAny
)
{
(local variable) raylib.MouseCursor current
current
=
(enum) raylib.MouseCursor
MouseCursor
.
(enum value) raylib.MouseCursor.MOUSE_CURSOR_DEFAULT = 0
MOUSE_CURSOR_DEFAULT
;
(local variable) const(char)* currentName
currentName
= "DEFAULT";
}
void raylib.SetMouseCursor(int cursor) nothrow @nogc
SetMouseCursor
(
(local variable) raylib.MouseCursor current
current
);
void raylib.BeginDrawing() nothrow @nogc
BeginDrawing
();
void raylib.ClearBackground(raylib.raylib_types.Color color) nothrow @nogc
ClearBackground
(
(struct) raylib.raylib_types.Color
Color
(28, 30, 34, 255));
void raylib.DrawText(const(char)* text, int posX, int posY, int fontSize, raylib.raylib_types.Color color) nothrow @nogc
DrawText
("Hover or click a tile to SetMouseCursor(...)", 16, 16, 20,
(enum) raylib.raylib_types.Colors
Colors
.
(enum value) raylib.raylib_types.Colors.RAYWHITE = Color(cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)255u)
RAYWHITE
);
void raylib.DrawText(const(char)* text, int posX, int posY, int fontSize, raylib.raylib_types.Color color) nothrow @nogc
DrawText
(
const(char)* raylib.TextFormat(const(char)* text, ...) nothrow @nogc
TextFormat
("requested: %s (raylib %s)",
(local variable) const(char)* currentName
currentName
,
(constant) string raylib.RAYLIB_VERSION = "6.0"
RAYLIB_VERSION
.
(constant) immutable(char)* "6.0".ptr = "6.0"
ptr
),
16, 44, 18,
(struct) raylib.raylib_types.Color
Color
(180, 200, 140, 255));
void raylib.DrawText(const(char)* text, int posX, int posY, int fontSize, raylib.raylib_types.Color color) nothrow @nogc
DrawText
("If the OS pointer does not change, GLFW could not realise that shape.",
16, 66, 16,
(struct) raylib.raylib_types.Color
Color
(160, 160, 160, 255));
foreach (
(parameter) ulong i
i
,
(parameter) immutable(cursor_shapes.Tile) tile
tile
;
(immutable global) immutable(cursor_shapes.Tile[]) cursor_shapes.main.tiles
tiles
)
{ const
(local variable) const(int) col
col
= cast(int)(
(local variable) ulong i
i
%
(local variable) const(int) cols
cols
);
const
(local variable) const(int) row
row
= cast(int)(
(local variable) ulong i
i
/
(local variable) const(int) cols
cols
);
const
(local variable) const(raylib.raylib_types.Rectangle) r
r
=
(struct) raylib.raylib_types.Rectangle
Rectangle
(
(local variable) const(int) margin
margin
+
(local variable) const(int) col
col
* (
(local variable) const(int) tw
tw
+
(local variable) const(int) gap
gap
),
(local variable) const(int) header
header
+
(local variable) const(int) row
row
* (
(local variable) const(int) th
th
+
(local variable) const(int) gap
gap
),
(local variable) const(int) tw
tw
,
(local variable) const(int) th
th
);
const
(local variable) const(bool) hot
hot
=
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) raylib.MouseCursor cursor_shapes.Tile.cursor
cursor
==
(local variable) raylib.MouseCursor current
current
&&
(local variable) bool overAny
overAny
;
void raylib.DrawRectangleRec(raylib.raylib_types.Rectangle rec, raylib.raylib_types.Color color) nothrow @nogc
DrawRectangleRec
(
(local variable) const(raylib.raylib_types.Rectangle) r
r
,
(local variable) const(bool) hot
hot
?
(struct) raylib.raylib_types.Color
Color
(70, 110, 160, 255) :
(struct) raylib.raylib_types.Color
Color
(50, 54, 60, 255));
void raylib.DrawRectangleLinesEx(raylib.raylib_types.Rectangle rec, float lineThick, raylib.raylib_types.Color color) nothrow @nogc
DrawRectangleLinesEx
(
(local variable) const(raylib.raylib_types.Rectangle) r
r
, 2,
(local variable) const(bool) hot
hot
?
(enum) raylib.raylib_types.Colors
Colors
.
(enum value) raylib.raylib_types.Colors.RAYWHITE = Color(cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)255u)
RAYWHITE
:
(struct) raylib.raylib_types.Color
Color
(90, 94, 100, 255));
const
(local variable) const(int) twid
twid
=
int raylib.MeasureText(const(char)* text, int fontSize) nothrow @nogc
MeasureText
(
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) const(char)* cursor_shapes.Tile.label
label
, 18);
void raylib.DrawText(const(char)* text, int posX, int posY, int fontSize, raylib.raylib_types.Color color) nothrow @nogc
DrawText
(
(local variable) immutable(cursor_shapes.Tile) tile
tile
.
(field) const(char)* cursor_shapes.Tile.label
label
,
cast(int)(
(local variable) const(raylib.raylib_types.Rectangle) r
r
.
(field) float raylib.raylib_types.Rectangle.x
x
+ (
(local variable) const(raylib.raylib_types.Rectangle) r
r
.
(field) float raylib.raylib_types.Rectangle.width
width
-
(local variable) const(int) twid
twid
) / 2),
cast(int)(
(local variable) const(raylib.raylib_types.Rectangle) r
r
.
(field) float raylib.raylib_types.Rectangle.y
y
+ (
(local variable) const(raylib.raylib_types.Rectangle) r
r
.
(field) float raylib.raylib_types.Rectangle.height
height
- 18) / 2),
18,
(enum) raylib.raylib_types.Colors
Colors
.
(enum value) raylib.raylib_types.Colors.RAYWHITE = Color(cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)245u, cast(ubyte)255u)
RAYWHITE
);
}
void raylib.EndDrawing() nothrow @nogc
EndDrawing
();
}
void raylib.CloseWindow() nothrow @nogc
CloseWindow
();
}