From 4fdeb6861bdc38f8f0c9dbd5f6d46e8b20990c13 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sun, 22 Sep 2024 01:04:25 -0400
Subject: [PATCH] examples: a few renderer fixes.
---
examples/CMakeLists.txt | 4 ++--
examples/renderer/06-textures/textures.c | 1 +
examples/renderer/07-streaming-textures/streaming-textures.c | 1 +
examples/renderer/08-rotating-textures/rotating-textures.c | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 7dcda44fcd303..788813eadb58f 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -125,9 +125,9 @@ add_sdl_example_executable(renderer-primitives SOURCES renderer/02-primitives/pr
add_sdl_example_executable(renderer-lines SOURCES renderer/03-lines/lines.c)
add_sdl_example_executable(renderer-points SOURCES renderer/04-points/points.c)
add_sdl_example_executable(renderer-rectangles SOURCES renderer/05-rectangles/rectangles.c)
-add_sdl_example_executable(renderer-textures SOURCES renderer/06-textures/textures.c)
+add_sdl_example_executable(renderer-textures SOURCES renderer/06-textures/textures.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.bmp)
add_sdl_example_executable(renderer-streaming-textures SOURCES renderer/07-streaming-textures/streaming-textures.c)
-add_sdl_example_executable(renderer-rotating-textures SOURCES renderer/08-rotating-textures/rotating-textures.c)
+add_sdl_example_executable(renderer-rotating-textures SOURCES renderer/08-rotating-textures/rotating-textures.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.bmp)
add_sdl_example_executable(audio-simple-playback SOURCES audio/01-simple-playback/simple-playback.c)
add_sdl_example_executable(audio-simple-playback-callback SOURCES audio/02-simple-playback-callback/simple-playback-callback.c)
add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.wav)
diff --git a/examples/renderer/06-textures/textures.c b/examples/renderer/06-textures/textures.c
index 406342b1cba35..a0bdb6c132d3c 100644
--- a/examples/renderer/06-textures/textures.c
+++ b/examples/renderer/06-textures/textures.c
@@ -119,6 +119,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* This function runs once at shutdown. */
void SDL_AppQuit(void *appstate)
{
+ SDL_DestroyTexture(texture);
/* SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/07-streaming-textures/streaming-textures.c b/examples/renderer/07-streaming-textures/streaming-textures.c
index 994efd7718cab..6b3a2d294506b 100644
--- a/examples/renderer/07-streaming-textures/streaming-textures.c
+++ b/examples/renderer/07-streaming-textures/streaming-textures.c
@@ -101,6 +101,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* This function runs once at shutdown. */
void SDL_AppQuit(void *appstate)
{
+ SDL_DestroyTexture(texture);
/* SDL will clean up the window/renderer for us. */
}
diff --git a/examples/renderer/08-rotating-textures/rotating-textures.c b/examples/renderer/08-rotating-textures/rotating-textures.c
index 850527bc9a336..91d68c8870c00 100644
--- a/examples/renderer/08-rotating-textures/rotating-textures.c
+++ b/examples/renderer/08-rotating-textures/rotating-textures.c
@@ -105,6 +105,7 @@ SDL_AppResult SDL_AppIterate(void *appstate)
/* This function runs once at shutdown. */
void SDL_AppQuit(void *appstate)
{
+ SDL_DestroyTexture(texture);
/* SDL will clean up the window/renderer for us. */
}