Update SDL2 to the latest hg revision of 2.0.4.

This commit is contained in:
Alex Szpakowski
2015-12-01 18:02:23 -04:00
parent 4206243c74
commit 3de7c6c2c9
124 changed files with 4371 additions and 1065 deletions
+12 -3
View File
@@ -243,8 +243,10 @@ main(int argc, char *argv[])
int i;
SDL_Joystick *joystick;
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
/* Initialize SDL (Note: video is required to start event loop) */
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
@@ -263,6 +265,7 @@ main(int argc, char *argv[])
SDL_GetError());
} else {
char guid[64];
SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick),
guid, sizeof (guid));
SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick));
@@ -275,7 +278,7 @@ main(int argc, char *argv[])
}
}
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IPHONEOS__)
if (SDL_NumJoysticks() > 0) {
#else
if (argv[1]) {
@@ -284,12 +287,15 @@ main(int argc, char *argv[])
SDL_bool keepGoing = SDL_TRUE;
SDL_Event event;
int device;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IPHONEOS__)
device = 0;
#else
device = atoi(argv[1]);
#endif
joystick = SDL_JoystickOpen(device);
if (joystick != NULL) {
SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
}
while ( keepGoing ) {
if (joystick == NULL) {
@@ -315,6 +321,9 @@ main(int argc, char *argv[])
keepGoing = SDL_FALSE;
} else if (event.type == SDL_JOYDEVICEADDED) {
joystick = SDL_JoystickOpen(device);
if (joystick != NULL) {
SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick);
}
break;
}
}