show joystick info
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9161 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 2c68c13475bc0a056fe6b1516ba8c6a95b9c7c8a Former-commit-id: d76e4aa8bb4d4ed14cc5143833a531d2836d41ac
This commit is contained in:
parent
86fe5f22b4
commit
aefd2958e1
1 changed files with 22 additions and 1 deletions
|
@ -305,6 +305,7 @@ gfctrlJoyInit(void)
|
|||
gfctrlJoyPresent = SDL_NumJoysticks();
|
||||
if (gfctrlJoyPresent > GFCTRL_JOY_NUMBER) gfctrlJoyPresent = GFCTRL_JOY_NUMBER;
|
||||
|
||||
GfLogInfo("%d Joysticks found\n", gfctrlJoyPresent);
|
||||
for (int index = 0; index < gfctrlJoyPresent; index++) {
|
||||
if (!Joysticks[index]) {
|
||||
Joysticks[index] = SDL_JoystickOpen(index);
|
||||
|
@ -323,9 +324,29 @@ gfctrlJoyInit(void)
|
|||
|
||||
// Find which Haptic device relates to this joystick
|
||||
Haptics[index] = SDL_HapticOpenFromJoystick(Joysticks[index]);
|
||||
|
||||
SDL_JoystickType type = SDL_JoystickGetType(Joysticks[index]);
|
||||
|
||||
GfLogInfo("Joystick %d: %s\n", index + 1, names[index].c_str());
|
||||
GfLogInfo(" vendor: %04x\n", SDL_JoystickGetVendor(Joysticks[index]));
|
||||
GfLogInfo(" product: %04x\n", SDL_JoystickGetProduct(Joysticks[index]));
|
||||
GfLogInfo(" type: %s\n", type == SDL_JOYSTICK_TYPE_UNKNOWN ? "Unknown" :
|
||||
type == SDL_JOYSTICK_TYPE_GAMECONTROLLER ? "Game Controller" :
|
||||
type == SDL_JOYSTICK_TYPE_WHEEL ? "Wheel" :
|
||||
type == SDL_JOYSTICK_TYPE_ARCADE_STICK ? "Arcade Stick" :
|
||||
type == SDL_JOYSTICK_TYPE_FLIGHT_STICK ? "Flight Stick" :
|
||||
type == SDL_JOYSTICK_TYPE_DANCE_PAD ? "Dance Pad" :
|
||||
type == SDL_JOYSTICK_TYPE_GUITAR ? "Guitar" :
|
||||
type == SDL_JOYSTICK_TYPE_DRUM_KIT ? "Drum Kit" :
|
||||
type == SDL_JOYSTICK_TYPE_ARCADE_PAD ? "Arcade Pad" :
|
||||
type == SDL_JOYSTICK_TYPE_THROTTLE ? "Throttle" :
|
||||
"Unknown");
|
||||
GfLogInfo(" axes: %d\n", SDL_JoystickNumAxes(Joysticks[index]));
|
||||
GfLogInfo(" buttons: %d\n", SDL_JoystickNumButtons(Joysticks[index]));
|
||||
GfLogInfo(" hats: %d\n", SDL_JoystickNumHats(Joysticks[index]));
|
||||
GfLogInfo(" haptic: %s\n", Haptics[index] ? "yes" : "no");
|
||||
|
||||
if (!Haptics[index]) {
|
||||
GfLogInfo("Joystick %d does not support haptic\n", index);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue