diff --git a/examples/audio/01-simple-playback/simple-playback.c b/examples/audio/01-simple-playback/simple-playback.c index 813e8317b..469667926 100644 --- a/examples/audio/01-simple-playback/simple-playback.c +++ b/examples/audio/01-simple-playback/simple-playback.c @@ -22,13 +22,13 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_AudioSpec spec; if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } /* we don't _need_ a window for audio-only things but it's good policy to have one. */ if (!SDL_CreateWindowAndRenderer("examples/audio/simple-playback", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -40,7 +40,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) spec.freq = 8000; stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, NULL, NULL); if (!stream) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create audio stream!", SDL_GetError(), window); + SDL_Log("Couldn't create audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/audio/02-simple-playback-callback/simple-playback-callback.c b/examples/audio/02-simple-playback-callback/simple-playback-callback.c index 221e92a66..327f6a968 100644 --- a/examples/audio/02-simple-playback-callback/simple-playback-callback.c +++ b/examples/audio/02-simple-playback-callback/simple-playback-callback.c @@ -54,13 +54,13 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_AudioSpec spec; if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } /* we don't _need_ a window for audio-only things but it's good policy to have one. */ if (!SDL_CreateWindowAndRenderer("examples/audio/simple-playback-callback", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -72,7 +72,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) spec.freq = 8000; stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, FeedTheAudioStreamMore, NULL); if (!stream) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create audio stream!", SDL_GetError(), window); + SDL_Log("Couldn't create audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/audio/03-load-wav/load-wav.c b/examples/audio/03-load-wav/load-wav.c index 79236525c..35443863c 100644 --- a/examples/audio/03-load-wav/load-wav.c +++ b/examples/audio/03-load-wav/load-wav.c @@ -32,20 +32,20 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *wav_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } /* we don't _need_ a window for audio-only things but it's good policy to have one. */ if (!SDL_CreateWindowAndRenderer("examples/audio/load-wav", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } /* Load the .wav file from wherever the app is being run from. */ SDL_asprintf(&wav_path, "%ssample.wav", SDL_GetBasePath()); /* allocate a string of the full file path */ if (!SDL_LoadWAV(wav_path, &spec, &wav_data, &wav_data_len)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load .wav file!", SDL_GetError(), NULL); + SDL_Log("Couldn't load .wav file: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -54,7 +54,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) /* Create our audio stream in the same format as the .wav file. It'll convert to what the audio hardware wants. */ stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, NULL, NULL); if (!stream) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create audio stream!", SDL_GetError(), window); + SDL_Log("Couldn't create audio stream: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/camera/01-read-and-draw/read-and-draw.c b/examples/camera/01-read-and-draw/read-and-draw.c index 9fbe616ce..12ae167e7 100644 --- a/examples/camera/01-read-and-draw/read-and-draw.c +++ b/examples/camera/01-read-and-draw/read-and-draw.c @@ -27,28 +27,28 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) int devcount = 0; if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_CAMERA)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/camera/read-and-draw", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } devices = SDL_GetCameras(&devcount); if (devices == NULL) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't enumerate camera devices!", SDL_GetError(), window); + SDL_Log("Couldn't enumerate camera devices: %s", SDL_GetError()); return SDL_APP_FAILURE; } else if (devcount == 0) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't find any camera devices!", "Please connect a camera and try again.", window); + SDL_Log("Couldn't find any camera devices! Please connect a camera and try again."); return SDL_APP_FAILURE; } camera = SDL_OpenCamera(devices[0], NULL); // just take the first thing we see in any format it wants. SDL_free(devices); if (camera == NULL) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't open camera!", SDL_GetError(), window); + SDL_Log("Couldn't open camera: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -64,7 +64,6 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) SDL_Log("Camera use approved by user!"); } else if (event->type == SDL_EVENT_CAMERA_DEVICE_DENIED) { SDL_Log("Camera use denied by user!"); - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Camera permission denied!", "User denied access to the camera!", window); return SDL_APP_FAILURE; } return SDL_APP_CONTINUE; /* carry on with the program! */ diff --git a/examples/pen/01-drawing-lines/drawing-lines.c b/examples/pen/01-drawing-lines/drawing-lines.c index 29bc2c43b..41f96715d 100644 --- a/examples/pen/01-drawing-lines/drawing-lines.c +++ b/examples/pen/01-drawing-lines/drawing-lines.c @@ -24,12 +24,12 @@ static float previous_touch_y = -1.0f; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/pen/drawing-lines", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -37,7 +37,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) Instead rendering a frame for us is a single texture draw. */ render_target = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, 640, 480); if (!render_target) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create render target!", SDL_GetError(), NULL); + SDL_Log("Couldn't create render target: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/01-clear/clear.c b/examples/renderer/01-clear/clear.c index 6de14bae3..b925958ec 100644 --- a/examples/renderer/01-clear/clear.c +++ b/examples/renderer/01-clear/clear.c @@ -18,12 +18,12 @@ static SDL_Renderer *renderer = NULL; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/clear", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/02-primitives/primitives.c b/examples/renderer/02-primitives/primitives.c index 89bc7f57c..e5d8a067c 100644 --- a/examples/renderer/02-primitives/primitives.c +++ b/examples/renderer/02-primitives/primitives.c @@ -20,12 +20,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) int i; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/primitives", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/03-lines/lines.c b/examples/renderer/03-lines/lines.c index ed121f504..3b18a3e7e 100644 --- a/examples/renderer/03-lines/lines.c +++ b/examples/renderer/03-lines/lines.c @@ -17,12 +17,12 @@ static SDL_Renderer *renderer = NULL; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/lines", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/04-points/points.c b/examples/renderer/04-points/points.c index d34a96655..4718f4b2a 100644 --- a/examples/renderer/04-points/points.c +++ b/examples/renderer/04-points/points.c @@ -37,12 +37,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) int i; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/points", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/05-rectangles/rectangles.c b/examples/renderer/05-rectangles/rectangles.c index 95f4864a6..c67f3865c 100644 --- a/examples/renderer/05-rectangles/rectangles.c +++ b/examples/renderer/05-rectangles/rectangles.c @@ -20,12 +20,12 @@ static SDL_Renderer *renderer = NULL; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/rectangles", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/06-textures/textures.c b/examples/renderer/06-textures/textures.c index 12fe70bcb..327cbf230 100644 --- a/examples/renderer/06-textures/textures.c +++ b/examples/renderer/06-textures/textures.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/textures", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/07-streaming-textures/streaming-textures.c b/examples/renderer/07-streaming-textures/streaming-textures.c index 3bbae3557..4107ab691 100644 --- a/examples/renderer/07-streaming-textures/streaming-textures.c +++ b/examples/renderer/07-streaming-textures/streaming-textures.c @@ -23,18 +23,18 @@ static SDL_Texture *texture = NULL; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/streaming-textures", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, TEXTURE_SIZE, TEXTURE_SIZE); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create streaming texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create streaming texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/08-rotating-textures/rotating-textures.c b/examples/renderer/08-rotating-textures/rotating-textures.c index 850d0e505..805c90a77 100644 --- a/examples/renderer/08-rotating-textures/rotating-textures.c +++ b/examples/renderer/08-rotating-textures/rotating-textures.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/rotating-textures", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/09-scaling-textures/scaling-textures.c b/examples/renderer/09-scaling-textures/scaling-textures.c index dc1cb3595..bf89c4b5e 100644 --- a/examples/renderer/09-scaling-textures/scaling-textures.c +++ b/examples/renderer/09-scaling-textures/scaling-textures.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/scaling-textures", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/10-geometry/geometry.c b/examples/renderer/10-geometry/geometry.c index 2d85812af..1a9399f59 100644 --- a/examples/renderer/10-geometry/geometry.c +++ b/examples/renderer/10-geometry/geometry.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/geometry", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/11-color-mods/color-mods.c b/examples/renderer/11-color-mods/color-mods.c index f6b9c2cbd..7e2618441 100644 --- a/examples/renderer/11-color-mods/color-mods.c +++ b/examples/renderer/11-color-mods/color-mods.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/color-mods", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/14-viewport/viewport.c b/examples/renderer/14-viewport/viewport.c index 096b799cd..7aadf4f8f 100644 --- a/examples/renderer/14-viewport/viewport.c +++ b/examples/renderer/14-viewport/viewport.c @@ -26,12 +26,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/viewport", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -44,7 +44,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/15-cliprect/cliprect.c b/examples/renderer/15-cliprect/cliprect.c index 4c69f47ec..7431efe9d 100644 --- a/examples/renderer/15-cliprect/cliprect.c +++ b/examples/renderer/15-cliprect/cliprect.c @@ -33,12 +33,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/cliprect", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -55,7 +55,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -63,7 +63,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } diff --git a/examples/renderer/17-read-pixels/read-pixels.c b/examples/renderer/17-read-pixels/read-pixels.c index b2cb52308..892b43103 100644 --- a/examples/renderer/17-read-pixels/read-pixels.c +++ b/examples/renderer/17-read-pixels/read-pixels.c @@ -35,12 +35,12 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) char *bmp_path = NULL; if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/renderer/read-pixels", WINDOW_WIDTH, WINDOW_HEIGHT, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -53,7 +53,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) SDL_asprintf(&bmp_path, "%ssample.bmp", SDL_GetBasePath()); /* allocate a string of the full file path */ surface = SDL_LoadBMP(bmp_path); if (!surface) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't load bitmap!", SDL_GetError(), NULL); + SDL_Log("Couldn't load bitmap: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -64,7 +64,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) texture = SDL_CreateTextureFromSurface(renderer, surface); if (!texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create static texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't create static texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } @@ -126,7 +126,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) SDL_DestroyTexture(converted_texture); converted_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, surface->w, surface->h); if (!converted_texture) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't (re)create conversion texture!", SDL_GetError(), NULL); + SDL_Log("Couldn't (re)create conversion texture: %s", SDL_GetError()); return SDL_APP_FAILURE; } converted_texture_width = surface->w; diff --git a/examples/template.c b/examples/template.c index 331db683e..af7a43cf3 100644 --- a/examples/template.c +++ b/examples/template.c @@ -17,12 +17,12 @@ static SDL_Renderer *renderer = NULL; SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { if (!SDL_Init(SDL_INIT_VIDEO)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't initialize SDL!", SDL_GetError(), NULL); + SDL_Log("Couldn't initialize SDL: %s", SDL_GetError()); return SDL_APP_FAILURE; } if (!SDL_CreateWindowAndRenderer("examples/CATEGORY/NAME", 640, 480, 0, &window, &renderer)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL); + SDL_Log("Couldn't create window/renderer: %s", SDL_GetError()); return SDL_APP_FAILURE; } return SDL_APP_CONTINUE; /* carry on with the program! */