mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-11 05:48:14 +00:00
Fix initialize GLFW's Joystick subsystem before window is created on Desktop platforms (#1554) (#1572)
This commit is contained in:
14
src/core.c
14
src/core.c
@@ -3329,6 +3329,20 @@ static bool InitGraphicsDevice(int width, int height)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
// NOTE: GLFW 3.4+ defers initialization of the Joystick subsystem on the
|
||||||
|
// first call to any Joystick related functions. Forcing this
|
||||||
|
// initialization here avoids doing it on `PollInputEvents` called by
|
||||||
|
// `EndDrawing` after first frame has been just drawn. The initialization
|
||||||
|
// will still happen and possible delays still occur, but before the window
|
||||||
|
// is shown, which is a nicer experience.
|
||||||
|
// Ref: https://github.com/raysan5/raylib/issues/1554
|
||||||
|
if (MAX_GAMEPADS > 0)
|
||||||
|
{
|
||||||
|
glfwSetJoystickCallback(NULL);
|
||||||
|
}
|
||||||
|
#endif // PLATFORM_DESKTOP
|
||||||
|
|
||||||
if (CORE.Window.fullscreen)
|
if (CORE.Window.fullscreen)
|
||||||
{
|
{
|
||||||
// remember center for switchinging from fullscreen to window
|
// remember center for switchinging from fullscreen to window
|
||||||
|
Reference in New Issue
Block a user