在 SDL2 中,SDL_JoystickInstanceID 何时不同于 SDL_JoystickOpen(n)?
In SDL2, when is SDL_JoystickInstanceID different than SDL_JoystickOpen(n)?
在 SDL2 the documentation suggests 中,用于打开操纵杆的数字(介于 0 和 SDL_NumJoysticks()
之间)可以不同于用于在事件中引用操纵杆的 SDL_JoystickID which;
。这些数字何时不同?
代码应该假定数字总是不同的(即使它们有时碰巧相同)。例如,当你得到一个SDL_ControllerAxisEvent
, the which
field should match the value of SDL_JoystickInstanceID()
for one of your open joystick handles. You can use SDL_JoystickFromInstanceID()
从which
值得到操纵杆句柄时。
在 SDL2 the documentation suggests 中,用于打开操纵杆的数字(介于 0 和 SDL_NumJoysticks()
之间)可以不同于用于在事件中引用操纵杆的 SDL_JoystickID which;
。这些数字何时不同?
代码应该假定数字总是不同的(即使它们有时碰巧相同)。例如,当你得到一个SDL_ControllerAxisEvent
, the which
field should match the value of SDL_JoystickInstanceID()
for one of your open joystick handles. You can use SDL_JoystickFromInstanceID()
从which
值得到操纵杆句柄时。