update SDL3 to libsdl-org/SDL@038a380 (3.3 development)

This commit is contained in:
Sasha Szpakowski
2025-06-22 16:51:22 -03:00
parent 8830ab01fe
commit ab332aa6ef
537 changed files with 50325 additions and 23727 deletions
+54 -28
View File
@@ -23,8 +23,7 @@
#endif
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
quit(int rc)
static void quit(int rc)
{
SDL_Quit();
/* Let 'main()' return normally */
@@ -33,9 +32,9 @@ quit(int rc)
}
}
static int SDLCALL
button_messagebox(void *eventNumber)
static int SDLCALL button_messagebox(void *eventNumber)
{
int i;
const SDL_MessageBoxButtonData buttons[] = {
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT,
0,
@@ -43,52 +42,79 @@ button_messagebox(void *eventNumber)
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT,
1,
"Cancel" },
{ 0,
2,
"Retry" }
};
SDL_MessageBoxData data = {
SDL_MESSAGEBOX_INFORMATION,
NULL, /* no parent window */
"Custom MessageBox",
"This is a custom messagebox",
2,
SDL_arraysize(buttons),
NULL, /* buttons */
NULL /* Default color scheme */
};
int button = -1;
int success = 0;
data.buttons = buttons;
if (eventNumber) {
data.message = "This is a custom messagebox from a background thread.";
}
for (i = 0; ; ++i) {
SDL_MessageBoxColorScheme colorScheme;
if (i != 0) {
int j;
for (j = 0; j < SDL_MESSAGEBOX_COLOR_COUNT; ++j) {
colorScheme.colors[j].r = SDL_rand(256);
colorScheme.colors[j].g = SDL_rand(256);
colorScheme.colors[j].b = SDL_rand(256);
}
data.colorScheme = &colorScheme;
} else {
data.colorScheme = NULL;
}
int button = -1;
data.buttons = buttons;
if (eventNumber) {
data.message = "This is a custom messagebox from a background thread.";
}
if (!SDL_ShowMessageBox(&data, &button)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError());
if (eventNumber) {
SDL_Event event;
event.type = (Uint32)(intptr_t)eventNumber;
SDL_PushEvent(&event);
return 1;
} else {
quit(2);
}
}
const char* text;
if (button == 1) {
text = "Cancel";
} else if (button == 2) {
text = "Retry";
} else {
text = "OK";
}
SDL_Log("Pressed button: %d, %s", button, button == -1 ? "[closed]" : text);
if (button == 2) {
continue;
}
success = SDL_ShowMessageBox(&data, &button);
if (success == -1) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s", SDL_GetError());
if (eventNumber) {
SDL_Event event;
event.type = (Uint32)(intptr_t)eventNumber;
SDL_PushEvent(&event);
return 1;
} else {
quit(2);
}
}
SDL_Log("Pressed button: %d, %s", button, button == -1 ? "[closed]" : button == 1 ? "Cancel"
: "OK");
if (eventNumber) {
SDL_Event event;
event.type = (Uint32)(intptr_t)eventNumber;
SDL_PushEvent(&event);
return 0;
}
return 0;
}
int main(int argc, char *argv[])
{
int success;
bool success;
SDLTest_CommonState *state;
/* Initialize test framework */