Update SDL2 to version 2.28.1.

This commit is contained in:
Sasha Szpakowski
2023-08-31 22:21:03 -03:00
parent 99b2757fc5
commit a82fcdd079
1394 changed files with 313046 additions and 190617 deletions
+15 -15
View File
@@ -1,5 +1,5 @@
/*
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -31,14 +31,12 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
static SDL_Haptic *haptic;
/**
* @brief The entry point of this force feedback demo.
* @param[in] argc Number of arguments.
* @param[in] argv Array of argc arguments.
*/
int
main(int argc, char **argv)
int main(int argc, char **argv)
{
int i;
char *name;
@@ -54,9 +52,9 @@ main(int argc, char **argv)
name = argv[1];
if ((SDL_strcmp(name, "--help") == 0) || (SDL_strcmp(name, "-h") == 0)) {
SDL_Log("USAGE: %s [device]\n"
"If device is a two-digit number it'll use it as an index, otherwise\n"
"it'll use it as if it were part of the device's name.\n",
argv[0]);
"If device is a two-digit number it'll use it as an index, otherwise\n"
"it'll use it as if it were part of the device's name.\n",
argv[0]);
return 0;
}
@@ -79,13 +77,14 @@ main(int argc, char **argv)
/* Try to find matching device */
else {
for (i = 0; i < SDL_NumHaptics(); i++) {
if (SDL_strstr(SDL_HapticName(i), name) != NULL)
if (SDL_strstr(SDL_HapticName(i), name) != NULL) {
break;
}
}
if (i >= SDL_NumHaptics()) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n",
name);
name);
return 1;
}
}
@@ -93,7 +92,7 @@ main(int argc, char **argv)
haptic = SDL_HapticOpen(i);
if (haptic == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n",
SDL_GetError());
SDL_GetError());
return 1;
}
SDL_Log("Device: %s\n", SDL_HapticName(i));
@@ -115,8 +114,8 @@ main(int argc, char **argv)
}
SDL_Log("Playing 2 second rumble at 0.5 magnitude.\n");
if (SDL_HapticRumblePlay(haptic, 0.5, 5000) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError() );
return 1;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError());
return 1;
}
SDL_Delay(2000);
SDL_Log("Stopping rumble.\n");
@@ -124,14 +123,15 @@ main(int argc, char **argv)
SDL_Delay(2000);
SDL_Log("Playing 2 second rumble at 0.3 magnitude.\n");
if (SDL_HapticRumblePlay(haptic, 0.3f, 5000) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError() );
return 1;
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError());
return 1;
}
SDL_Delay(2000);
/* Quit */
if (haptic != NULL)
if (haptic != NULL) {
SDL_HapticClose(haptic);
}
SDL_Quit();
return 0;