Setup standard cursors _after_ GLFW window initialization

This commit is contained in:
Chance Snow 2020-10-07 15:43:42 -05:00
parent f251449efb
commit 319014dbbf
2 changed files with 31 additions and 31 deletions

View File

@ -663,26 +663,6 @@ void InitWindow(int width, int height, const char *title)
CORE.Input.Gamepad.axisCount = 6; CORE.Input.Gamepad.axisCount = 6;
#endif #endif
#if defined(PLATFORM_DESKTOP)
// Initialize GLFW's standard cursors
const int shapes[] = {
MOUSE_CURSOR_ARROW,
MOUSE_CURSOR_IBEAM,
MOUSE_CURSOR_CROSSHAIR,
MOUSE_CURSOR_POINTING_HAND,
MOUSE_CURSOR_RESIZE_EW,
MOUSE_CURSOR_RESIZE_NS,
MOUSE_CURSOR_RESIZE_NWSE,
MOUSE_CURSOR_RESIZE_NESW,
MOUSE_CURSOR_RESIZE_ALL,
MOUSE_CURSOR_NOT_ALLOWED
};
for (int i = 0; i < sizeof(CORE.Input.Mouse.standardCursors) / sizeof(CORE.Input.Mouse.standardCursors[0]); i += 1)
{
CORE.Input.Mouse.standardCursors[i] = glfwCreateStandardCursor(shapes[i]);
}
#endif
#if defined(PLATFORM_ANDROID) #if defined(PLATFORM_ANDROID)
CORE.Window.screen.width = width; CORE.Window.screen.width = width;
CORE.Window.screen.height = height; CORE.Window.screen.height = height;
@ -776,6 +756,26 @@ void InitWindow(int width, int height, const char *title)
#endif #endif
#endif #endif
#if defined(PLATFORM_DESKTOP)
// Initialize GLFW's standard cursors
const int shapes[] = {
0x00036001, // MOUSE_CURSOR_ARROW
0x00036002, // MOUSE_CURSOR_IBEAM
0x00036003, // MOUSE_CURSOR_CROSSHAIR
0x00036004, // MOUSE_CURSOR_POINTING_HAND
0x00036005, // MOUSE_CURSOR_RESIZE_EW
0x00036006, // MOUSE_CURSOR_RESIZE_NS
0x00036007, // MOUSE_CURSOR_RESIZE_NWSE
0x00036008, // MOUSE_CURSOR_RESIZE_NESW
0x00036009, // MOUSE_CURSOR_RESIZE_ALL
0x0003600A, // MOUSE_CURSOR_NOT_ALLOWED
};
for (int i = 0; i < sizeof(CORE.Input.Mouse.standardCursors) / sizeof(CORE.Input.Mouse.standardCursors[0]); i += 1)
{
CORE.Input.Mouse.standardCursors[i] = glfwCreateStandardCursor(shapes[i]);
}
#endif
#if defined(PLATFORM_WEB) #if defined(PLATFORM_WEB)
// Detect fullscreen change events // Detect fullscreen change events
emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback); emscripten_set_fullscreenchange_callback("#canvas", NULL, 1, EmscriptenFullscreenChangeCallback);

View File

@ -619,23 +619,23 @@ typedef enum {
// Mouse cursor types // Mouse cursor types
typedef enum { typedef enum {
MOUSE_CURSOR_DEFAULT = 0, MOUSE_CURSOR_DEFAULT = -1,
MOUSE_CURSOR_ARROW = 0x00036001, MOUSE_CURSOR_ARROW = 0,
MOUSE_CURSOR_IBEAM = 0x00036002, MOUSE_CURSOR_IBEAM = 1,
MOUSE_CURSOR_CROSSHAIR = 0x00036003, MOUSE_CURSOR_CROSSHAIR = 2,
MOUSE_CURSOR_POINTING_HAND = 0x00036004, MOUSE_CURSOR_POINTING_HAND = 3,
// The horizontal resize/move arrow shape. // The horizontal resize/move arrow shape.
MOUSE_CURSOR_RESIZE_EW = 0x00036005, MOUSE_CURSOR_RESIZE_EW = 4,
// The vertical resize/move arrow shape. // The vertical resize/move arrow shape.
MOUSE_CURSOR_RESIZE_NS = 0x00036006, MOUSE_CURSOR_RESIZE_NS = 5,
// The top-left to bottom-right diagonal resize/move arrow shape. // The top-left to bottom-right diagonal resize/move arrow shape.
MOUSE_CURSOR_RESIZE_NWSE = 0x00036007, MOUSE_CURSOR_RESIZE_NWSE = 6,
// The top-right to bottom-left diagonal resize/move arrow shape. // The top-right to bottom-left diagonal resize/move arrow shape.
MOUSE_CURSOR_RESIZE_NESW = 0x00036008, MOUSE_CURSOR_RESIZE_NESW = 7,
// The omni-directional resize/move cursor shape. // The omni-directional resize/move cursor shape.
MOUSE_CURSOR_RESIZE_ALL = 0x00036009, MOUSE_CURSOR_RESIZE_ALL = 8,
// The operation-not-allowed shape. // The operation-not-allowed shape.
MOUSE_CURSOR_NOT_ALLOWED = 0x0003600A, MOUSE_CURSOR_NOT_ALLOWED = 9
} MouseCursor; } MouseCursor;
// Gamepad number // Gamepad number