Hi. I’m making a C++ game under Manjaro linux
I’m correctly initializing joystick subsystem, no errors
I see no message from this code:
switch(event.type)
{
case SDL_JOYHATMOTION:
cout << " SDL_JOYHATMOTION hat: " << (int)event.jhat.hat << " value: " << (int)event.jhat.value << " joy id: " << event.jhat.which << endl;
break;
This code always returns SDL_HAT_CENTERED (I’m querying the hat number 0):
int currentHatPosition = static_cast<int>(SDL_JoystickGetHat(joy, hat));
When I do devices enumeration with this code:
cout << " Using joystick: \'" << SDL_JoystickNameForIndex(i)
<< "\', buttons: " << SDL_JoystickNumButtons(joy)
<< ", axes: " << SDL_JoystickNumAxes(joy)
<< ", hats: " << SDL_JoystickNumHats(joy)
<< ", balls: " << SDL_JoystickNumBalls(joy)
<< endl;
I got this message on the console:
Using joystick: 'Xbox 360 Controller', buttons: 15, axes: 6, hats: 0, balls: 0
My OS can detect the joystick, and other components like axis and buttons works fine in my game. Why do the hat always reports SDL_HAT_CENTERED?