blob: f40b7da691b3aea1b8225bd08c111383fbc3dd64 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include <SDL.h>
void dump_guid(SDL_Joystick *js) {
SDL_JoystickGUID guid;
const char *name;
char guidstr[33];
guid = SDL_JoystickGetGUID(js);
name = SDL_JoystickName(js);
SDL_JoystickGetGUIDString(guid, guidstr, sizeof(guidstr));
printf("%s: %s\n", name, guidstr);
}
int main()
{
int i;
SDL_Joystick *js;
SDL_Init(SDL_INIT_JOYSTICK);
atexit(SDL_Quit);
for (i = 0; i < SDL_NumJoysticks(); ++i) {
if ((js = SDL_JoystickOpen(i)) != NULL) {
dump_guid(js);
SDL_JoystickClose(js);
}
}
return EXIT_SUCCESS;
}
|