Callback for controller support

I am trying to save the input from a xbox controller but glfwSetJoystickCallback works differently from glfwSetKeyCallback. glfwSetKeyCallback is triggered when a key is pressed but
glfwSetJoystickCallback only triggers when the controller is either connected/disconnected.

Is there a way to trigger the callbacks for controller similar to glfwSetKeyCallback, in order to add
controller support for my own input system? Thank you!

Joystick & Gamepad API in glfw does not use callback to get input to your code. You simply call GetJoystickButtons, GetJoystickAxes or GetGamepadState once per frame to get current state of joystick/gamepad. If you want to have a “callback” when these values change then you need to keep previous values yourself, and compare to new values - and if you detect they have changed, then call any function in your code you want.

More info here: GLFW: Input guide

Joystick axis, button and hat state is updated when polled and does not require a window to be created or events to be processed.

okay will give it a try, thank you so much!