summaryrefslogtreecommitdiff
path: root/test/testjoystick.c
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2017-01-31 10:20:09 -0800
committerSam Lantinga <slouken@libsdl.org>2017-01-31 10:20:09 -0800
commit77cb064d8553267afb6a0c182e84cdba2d97099c (patch)
treeafc9aa8194cb197e25282f5234e2060023757a60 /test/testjoystick.c
parent7086896e9f0ccc46fe3a43fdaa33f769a04f4b90 (diff)
downloadsdl-77cb064d8553267afb6a0c182e84cdba2d97099c.tar.gz
Added the HOTAS Warthog as a flight stick
Diffstat (limited to 'test/testjoystick.c')
-rw-r--r--test/testjoystick.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/testjoystick.c b/test/testjoystick.c
index 358b7290a..ce3a22214 100644
--- a/test/testjoystick.c
+++ b/test/testjoystick.c
@@ -239,7 +239,7 @@ WatchJoystick(SDL_Joystick * joystick)
int
main(int argc, char *argv[])
{
- const char *name;
+ const char *name, *type;
int i;
SDL_Joystick *joystick;
@@ -268,6 +268,36 @@ main(int argc, char *argv[])
SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick),
guid, sizeof (guid));
+ switch (SDL_JoystickGetType(joystick)) {
+ case SDL_JOYSTICK_TYPE_GAMECONTROLLER:
+ type = "Game Controller";
+ break;
+ case SDL_JOYSTICK_TYPE_WHEEL:
+ type = "Wheel";
+ break;
+ case SDL_JOYSTICK_TYPE_ARCADE_STICK:
+ type = "Arcade Stick";
+ break;
+ case SDL_JOYSTICK_TYPE_FLIGHT_STICK:
+ type = "Flight Stick";
+ break;
+ case SDL_JOYSTICK_TYPE_DANCE_PAD:
+ type = "Dance Pad";
+ break;
+ case SDL_JOYSTICK_TYPE_GUITAR:
+ type = "Guitar";
+ break;
+ case SDL_JOYSTICK_TYPE_DRUM_KIT:
+ type = "Drum Kit";
+ break;
+ case SDL_JOYSTICK_TYPE_ARCADE_PAD:
+ type = "Arcade Pad";
+ break;
+ default:
+ type = "Unknown";
+ break;
+ }
+ SDL_Log(" type: %s\n", type);
SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick));
SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick));
SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick));