Skip to content

Commit

Permalink
asyncio: Added async i/o APIs.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 30, 2024
1 parent 1787d6c commit eabc72f
Show file tree
Hide file tree
Showing 22 changed files with 1,886 additions and 4 deletions.
1 change: 1 addition & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
$(wildcard $(LOCAL_PATH)/src/file/generic/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/vulkan/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/dynapi/*.c"
"${SDL3_SOURCE_DIR}/src/events/*.c"
"${SDL3_SOURCE_DIR}/src/file/*.c"
"${SDL3_SOURCE_DIR}/src/file/generic/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/*.c"
"${SDL3_SOURCE_DIR}/src/gpu/*.c"
"${SDL3_SOURCE_DIR}/src/joystick/*.c"
Expand Down Expand Up @@ -2105,8 +2106,6 @@ elseif(APPLE)
set(HAVE_SDL_MAIN_CALLBACKS TRUE)
endif()

sdl_glob_sources("${SDL3_SOURCE_DIR}/src/file/cocoa/*.m")

if(SDL_CAMERA)
if(MACOS OR IOS)
set(SDL_CAMERA_DRIVER_COREMEDIA 1)
Expand Down
5 changes: 5 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hidapi.h" />
<ClInclude Include="..\..\include\SDL3\SDL_asyncio.h" />
<ClInclude Include="..\..\include\SDL3\SDL_joystick.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keyboard.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keycode.h" />
Expand Down Expand Up @@ -432,6 +433,8 @@
<ClInclude Include="..\..\src\events\SDL_windowevents_c.h" />
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h" />
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down Expand Up @@ -517,6 +520,8 @@
<ClCompile Include="..\..\src\dialog\SDL_dialog_utils.c" />
<ClCompile Include="..\..\src\filesystem\SDL_filesystem.c" />
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfsops.c" />
<ClCompile Include="..\..\src\file\generic\SDL_asyncio_generic.c" />
<ClCompile Include="..\..\src\file\SDL_asyncio.c" />
<ClCompile Include="..\..\src\main\gdk\SDL_sysmain_runapp.cpp" />
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
<ClCompile Include="..\..\src\main\SDL_main_callbacks.c" />
Expand Down
15 changes: 15 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfsops.c">
<Filter>filesystem\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\generic\SDL_asyncio_generic.c">
<Filter>file\generic</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\SDL_asyncio.c">
<Filter>file</Filter>
</ClCompile>
<ClCompile Include="..\..\src\render\direct3d12\SDL_render_d3d12_xbox.cpp" />
<ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxone.cpp" />
<ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12_xboxseries.cpp" />
Expand Down Expand Up @@ -263,6 +269,9 @@
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hidapi.h" />
<ClInclude Include="..\..\include\SDL3\SDL_asyncio.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_joystick.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keyboard.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keycode.h" />
Expand Down Expand Up @@ -354,6 +363,12 @@
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down
5 changes: 5 additions & 0 deletions VisualC/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
<ClInclude Include="..\..\include\SDL3\SDL_haptic.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hints.h" />
<ClInclude Include="..\..\include\SDL3\SDL_hidapi.h" />
<ClInclude Include="..\..\include\SDL3\SDL_asyncio.h" />
<ClInclude Include="..\..\include\SDL3\SDL_joystick.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keyboard.h" />
<ClInclude Include="..\..\include\SDL3\SDL_keycode.h" />
Expand Down Expand Up @@ -352,6 +353,8 @@
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\..\src\gpu\SDL_sysgpu.h" />
<ClInclude Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan_vkfuncs.h" />
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h" />
<ClInclude Include="..\..\src\haptic\SDL_haptic_c.h" />
<ClInclude Include="..\..\src\haptic\SDL_syshaptic.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
Expand Down Expand Up @@ -416,6 +419,8 @@
<ClCompile Include="..\..\src\gpu\d3d11\SDL_gpu_d3d11.c" />
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
<ClCompile Include="..\..\src\gpu\vulkan\SDL_gpu_vulkan.c" />
<ClCompile Include="..\..\src\file\generic\SDL_asyncio_generic.c" />
<ClCompile Include="..\..\src\file\SDL_asyncio.c" />
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c" />
<ClCompile Include="..\..\src\main\SDL_main_callbacks.c" />
<ClCompile Include="..\..\src\main\SDL_runapp.c" />
Expand Down
18 changes: 18 additions & 0 deletions VisualC/SDL/SDL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
<Filter Include="main\windows">
<UniqueIdentifier>{00009d5ded166cc6c6680ec771a30000}</UniqueIdentifier>
</Filter>
<Filter Include="file\generic">
<UniqueIdentifier>{00004d6806b6238cae0ed62db5440000}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\SDL3\SDL_begin_code.h">
Expand Down Expand Up @@ -279,6 +282,9 @@
<ClInclude Include="..\..\include\SDL3\SDL_hidapi.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_asyncio.h">
<Filter>API Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\SDL3\SDL_joystick.h">
<Filter>API Headers</Filter>
</ClInclude>
Expand Down Expand Up @@ -438,6 +444,12 @@
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h">
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="..\..\src\main\SDL_main_callbacks.h">
<Filter>main</Filter>
</ClInclude>
Expand Down Expand Up @@ -944,6 +956,12 @@
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfsops.c">
<Filter>filesystem\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\generic\SDL_asyncio_generic.c">
<Filter>file\generic</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\SDL_asyncio.c">
<Filter>file</Filter>
</ClCompile>
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c">
<Filter>main\generic</Filter>
</ClCompile>
Expand Down
29 changes: 29 additions & 0 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@
F3FD042E2C9B755700824C4C /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FD042C2C9B755700824C4C /* SDL_hidapi_nintendo.h */; };
F3FD042F2C9B755700824C4C /* SDL_hidapi_steam_hori.c in Sources */ = {isa = PBXBuildFile; fileRef = F3FD042D2C9B755700824C4C /* SDL_hidapi_steam_hori.c */; };
FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); };
0000E5D7110DFF81FF660000 /* SDL_cocoapen.h in Headers */ = {isa = PBXBuildFile; fileRef = 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */; };
0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; };
0000AEB9AE90228CA2D60000 /* SDL_asyncio.c in Sources */ = {isa = PBXBuildFile; fileRef = 00003928A612EC33D42C0000 /* SDL_asyncio.c */; };
000062F9C843687F50F70000 /* SDL_asyncio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0000919399B1A908267F0000 /* SDL_asyncio_c.h */; };
00005081394CCF8322BE0000 /* SDL_sysasyncio.h in Headers */ = {isa = PBXBuildFile; fileRef = 0000585B2CAB450B40540000 /* SDL_sysasyncio.h */; };
000018AF97C08F2DAFFD0000 /* SDL_asyncio.h in Headers */ = {isa = PBXBuildFile; fileRef = 00004945A946DF5B1AED0000 /* SDL_asyncio.h */; settings = {ATTRIBUTES = (Public, ); }; };
00004D0B73767647AD550000 /* SDL_asyncio_generic.c in Sources */ = {isa = PBXBuildFile; fileRef = 0000FB02CDE4BE34A87E0000 /* SDL_asyncio_generic.c */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -1123,6 +1130,13 @@
F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoapen.h; path = SDL_cocoapen.h; sourceTree = "<group>"; };
0000CCA310B73A7B59910000 /* SDL_cocoapen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoapen.m; path = SDL_cocoapen.m; sourceTree = "<group>"; };
00003928A612EC33D42C0000 /* SDL_asyncio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_asyncio.c; path = SDL_asyncio.c; sourceTree = "<group>"; };
0000919399B1A908267F0000 /* SDL_asyncio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_asyncio_c.h; path = SDL_asyncio_c.h; sourceTree = "<group>"; };
0000585B2CAB450B40540000 /* SDL_sysasyncio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_sysasyncio.h; path = SDL_sysasyncio.h; sourceTree = "<group>"; };
00004945A946DF5B1AED0000 /* SDL_asyncio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_asyncio.h; path = SDL3/SDL_asyncio.h; sourceTree = "<group>"; };
0000FB02CDE4BE34A87E0000 /* SDL_asyncio_generic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_asyncio_generic.c; path = SDL_asyncio_generic.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -1298,6 +1312,7 @@
F3F7D8C52933074B00816151 /* SDL_video.h */,
F3F7D8D42933074C00816151 /* SDL_vulkan.h */,
F3F7D8CF2933074C00816151 /* SDL.h */,
00004945A946DF5B1AED0000 /* SDL_asyncio.h */,
);
name = "Public Headers";
path = ../../include;
Expand Down Expand Up @@ -1940,6 +1955,10 @@
isa = PBXGroup;
children = (
A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */,
00003928A612EC33D42C0000 /* SDL_asyncio.c */,
0000919399B1A908267F0000 /* SDL_asyncio_c.h */,
0000585B2CAB450B40540000 /* SDL_sysasyncio.h */,
000013C0F2EADC24ADC10000 /* generic */,
);
path = file;
sourceTree = "<group>";
Expand Down Expand Up @@ -2432,6 +2451,14 @@
path = resources;
sourceTree = "<group>";
};
000013C0F2EADC24ADC10000 /* generic */ = {
isa = PBXGroup;
children = (
0000FB02CDE4BE34A87E0000 /* SDL_asyncio_generic.c */,
);
path = generic;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -3058,6 +3085,8 @@
0000140640E77F73F1DF0000 /* SDL_dialog_utils.c in Sources */,
0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */,
6312C66D2B42341400A7BB00 /* SDL_murmur3.c in Sources */,
0000AEB9AE90228CA2D60000 /* SDL_asyncio.c in Sources */,
00004D0B73767647AD550000 /* SDL_asyncio_generic.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ add_sdl_example_executable(audio-load-wav SOURCES audio/03-load-wav/load-wav.c D
add_sdl_example_executable(camera-read-and-draw SOURCES camera/01-read-and-draw/read-and-draw.c)
add_sdl_example_executable(pen-drawing-lines SOURCES pen/01-drawing-lines/drawing-lines.c)
add_sdl_example_executable(game-snake SOURCES game/01-snake/snake.c)

add_sdl_example_executable(asyncio-load-bitmaps SOURCES asyncio/01-load-bitmaps/load-bitmaps.c DATAFILES ${CMAKE_CURRENT_SOURCE_DIR}/../test/sample.bmp ${CMAKE_CURRENT_SOURCE_DIR}/../test/gamepad_front.bmp ${CMAKE_CURRENT_SOURCE_DIR}/../test/speaker.bmp ${CMAKE_CURRENT_SOURCE_DIR}/../test/icon2x.bmp)

if(PSP)
# Build EBOOT files if building for PSP
Expand Down
6 changes: 6 additions & 0 deletions examples/asyncio/01-load-bitmaps/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This example code loads a few bitmap files from disk using the asynchronous
i/o, and then draws it to the window. It uses a task group to watch multiple
reads and deal with them in whatever order they finish.

Note that for a single tiny file like this, you'd probably not want to bother
with async i/o in real life, but this is just an example of how to do it.
125 changes: 125 additions & 0 deletions examples/asyncio/01-load-bitmaps/load-bitmaps.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* This example code loads a bitmap with asynchronous i/o and renders it.
*
* This code is public domain. Feel free to use it for any purpose!
*/

#define SDL_MAIN_USE_CALLBACKS 1 /* use the callbacks instead of main() */
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>

/* We will use this renderer to draw into this window every frame. */
static SDL_Window *window = NULL;
static SDL_Renderer *renderer = NULL;
static SDL_AsyncIOQueue *queue = NULL;

#define TOTAL_TEXTURES 4
static const char * const bmps[TOTAL_TEXTURES] = { "sample.bmp", "gamepad_front.bmp", "speaker.bmp", "icon2x.bmp" };
static SDL_Texture *textures[TOTAL_TEXTURES];
static const SDL_FRect texture_rects[TOTAL_TEXTURES] = {
{ 116, 156, 408, 167 },
{ 20, 200, 96, 60 },
{ 525, 180, 96, 96 },
{ 288, 375, 64, 64 }
};

/* This function runs once at startup. */
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);
return SDL_APP_FAILURE;
}

if (!SDL_CreateWindowAndRenderer("examples/asyncio/load-bitmaps", 640, 480, 0, &window, &renderer)) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create window/renderer!", SDL_GetError(), NULL);
return SDL_APP_FAILURE;
}

queue = SDL_CreateAsyncIOQueue();
if (!queue) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create async i/o queue!", SDL_GetError(), NULL);
return SDL_APP_FAILURE;
}

/* Load some .bmp files asynchronously from wherever the app is being run from, put them in the same queue. */
for (i = 0; i < SDL_arraysize(bmps); i++) {
char *path = NULL;
SDL_asprintf(&path, "%s%s", SDL_GetBasePath(), bmps[i]); /* allocate a string of the full file path */
/* you _should) check for failure, but we'll just go on without files here. */
SDL_LoadFileAsync(path, queue, (void *) bmps[i]); /* attach the filename as app-specific data, so we can see it later. */
SDL_free(path);
}

return SDL_APP_CONTINUE; /* carry on with the program! */
}

/* This function runs when a new event (mouse input, keypresses, etc) occurs. */
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event)
{
if (event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */
}

return SDL_APP_CONTINUE; /* carry on with the program! */
}

/* This function runs once per frame, and is the heart of the program. */
SDL_AppResult SDL_AppIterate(void *appstate)
{
SDL_AsyncIOOutcome outcome;
int i;

if (SDL_GetAsyncIOResult(queue, &outcome)) { /* a .bmp file load has finished? */
if (outcome.result == SDL_ASYNCIO_COMPLETE) {
/* this might be _any_ of the bmps; they might finish loading in any order. */
for (i = 0; i < SDL_arraysize(bmps); i++) {
/* this doesn't need a strcmp because we gave the pointer from this array to SDL_LoadFileAsync */
if (outcome.userdata == bmps[i]) {
break;
}
}

if (i < SDL_arraysize(bmps)) { /* (just in case.) */
SDL_Surface *surface = SDL_LoadBMP_IO(SDL_IOFromConstMem(outcome.buffer, (size_t) outcome.bytes_transferred), true);
if (surface) { /* the renderer is not multithreaded, so create the texture here once the data loads. */
textures[i] = SDL_CreateTextureFromSurface(renderer, surface);
if (!textures[i]) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Couldn't create texture!", SDL_GetError(), NULL);
return SDL_APP_FAILURE;
}
SDL_DestroySurface(surface);
}
}
}
SDL_free(outcome.buffer);
}

SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);

for (i = 0; i < SDL_arraysize(textures); i++) {
SDL_RenderTexture(renderer, textures[i], NULL, &texture_rects[i]);
}

SDL_RenderPresent(renderer);

return SDL_APP_CONTINUE; /* carry on with the program! */
}

/* This function runs once at shutdown. */
void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
int i;

SDL_DestroyAsyncIOQueue(queue);

for (i = 0; i < SDL_arraysize(textures); i++) {
SDL_DestroyTexture(textures[i]);
}

/* SDL will clean up the window/renderer for us. */
}

1 change: 1 addition & 0 deletions include/SDL3/SDL.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_assert.h>
#include <SDL3/SDL_asyncio.h>
#include <SDL3/SDL_atomic.h>
#include <SDL3/SDL_audio.h>
#include <SDL3/SDL_bits.h>
Expand Down
Loading

0 comments on commit eabc72f

Please sign in to comment.