Sam Lantinga
538adc52d2
Removed the temporary memory symbols from the public API
2024-07-26 21:10:47 -07:00
Sam Lantinga
4f55271571
Removed temporary memory from the API
...
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.
So, we're largely going back to the original system, where the API returns allocated results and you free them.
In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
Sam Lantinga
5e513ecc7f
Don't automatically free temporary memory, let the application call SDL_FreeTemporaryMemory() when it's ready.
...
Also mark up all functions that return temporary memory with SDL_DECLSPEC_TEMP, to help people implementing language bindings.
Fixes https://github.com/libsdl-org/SDL/issues/10378
2024-07-26 10:05:03 -07:00
Sam Lantinga
cf8b158ccb
Added SDL_GetRenderSafeArea()
2024-07-24 17:40:41 -07:00
Sam Lantinga
a7c0192017
Renamed SDL_PostSemaphore() to SDL_SignalSemphore()
2024-07-24 13:37:40 -07:00
Sam Lantinga
fa0918a686
Renamed SDL life cycle functions
...
This maps better to how SDL delivers the events, and the iOS delegate methods are in the documentation for reference.
2024-07-24 05:11:13 -07:00
Sam Lantinga
457ca3995c
Added SDL_GetWindowSafeArea()
...
Fixes https://github.com/libsdl-org/SDL/issues/3243
2024-07-23 17:06:04 -07:00
Sam Lantinga
66011e497d
Removed duplication in SDL_EGL_* function names
2024-07-23 13:11:37 -07:00
Sam Lantinga
29f0fd33dc
SDL_getenv() should return const
...
This also allows us to use SDL_FreeLater() and make SDL_getenv() thread-safe on Windows.
2024-07-22 13:00:39 -07:00
Sam Lantinga
ef21e31a9a
SDL_GUIDFromString() renamed SDL_StringToGUID()
2024-07-22 12:39:15 -07:00
Sam Lantinga
c4bf5f9f59
SDL_CreateTexture() uses the SDL_TextureAccess type for the access parameter
2024-07-22 09:32:02 -07:00
Sam Lantinga
ff1d351390
Removed SDL_FreeTemporaryMemory()
...
This was just causing confusion and anxiety. SDL temporary memory will be automatically freed on the main thread when processing events and on other threads when it ages out after a second. The application can free it directly by calling SDL_ClaimTemporaryMemory() to get ownership of the pointer, if necessary.
2024-07-22 07:34:25 -07:00
Sam Lantinga
033c9c5951
Added SDL_CopyFile() and SDL_CopyStorageFile()
...
Fixes https://github.com/libsdl-org/SDL/issues/9553
2024-07-21 19:58:23 -07:00
Sam Lantinga
6209c71f54
Added SDL_BlitSurface9Grid() and SDL_RenderTexture9Grid()
2024-07-20 18:21:19 -07:00
Sam Lantinga
9294476788
Added SDL_WriteSurfacePixel() and SDL_WriteSurfacePixelFloat()
2024-07-20 18:21:19 -07:00
Sam Lantinga
12e50d17a2
Removed SDL_SoftStretch() from the public API
...
SDL_BlitSurfaceScaled() is more flexible and uses the SDL_SoftStretch() fast path when possible. Having two surface scaling APIs was confusing, especially when one of them has unexpected limitations.
2024-07-20 18:21:19 -07:00
Sam Lantinga
67fa7a9138
SDL_BlitSurface() and SDL_BlitSurfaceScaled() now have a const dstrect parameter
...
This was originally to avoid duplicating clipping work in Maelstrom on a 486 computer. This has been confusing for users and computers are a little faster these days, so we'll make it work the way people expect.
2024-07-20 18:21:19 -07:00
Sam Lantinga
198caa54a1
Added SDL_RenderTextureTiled()
2024-07-20 18:21:19 -07:00
Sam Lantinga
9e55ee9391
Added SDL_BlitSurfaceTiledWithScale()
2024-07-20 18:21:19 -07:00
Sam Lantinga
f47ddbf1ac
Added SDL_BlitSurfaceTiled()
...
Fixes https://gamedev.stackexchange.com/questions/136792/is-there-a-way-to-set-texture-wrap-mode-as-repeat-in-sdl-2
2024-07-20 18:21:19 -07:00
Sam Lantinga
b80784fced
SDL_GetGamepadBindings() follows the SDL_GetStringRule
2024-07-19 13:06:54 -07:00
Sam Lantinga
0079b6d45f
SDL_GetTouchFingers() follows the SDL_GetStringRule
2024-07-19 13:06:54 -07:00
Sam Lantinga
fd9fe1bb7b
Renamed event memory to temporary memory, since it's not just used for events
2024-07-19 12:22:03 -07:00
Sam Lantinga
c4eac60000
SDL_GetClipboardData() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
61a7a0e579
SDL_GUIDToString() follows the SDL_GetStringRule
...
Also removed the distinction between SDL_GUID and SDL_JoystickGUID
2024-07-19 12:22:03 -07:00
Sam Lantinga
892df4bf4b
SDL_GetWindowICCProfile() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
eb22fcce35
SDL_GetTouchDevices() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
856d598d6e
SDL_GetSensors() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
4f8c348402
SDL_GetPreferredLocales() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
9be73ed7c5
SDL_GetMice() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
6ca18ed0e5
SDL_GetKeyboards() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
5ce0aacaa4
SDL_GetGamepads() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
4961af4569
SDL_GetJoysticks() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
b32c9615a7
SDL_GetHaptics() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
9de8cb888a
SDL_GetFullscreenDisplayModes() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
9758e102bc
SDL_GetDisplays() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
01199469de
SDL_GetCameras() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
0fe6603747
SDL_GetCameraSupportedFormats() follows the SDL_GetStringRule
...
Also changed the function to return an array of pointers and added example usage to testcamera
2024-07-19 12:22:03 -07:00
Sam Lantinga
bdafc8e212
SDL_GetWindows() follows the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
8ca6caeda5
SDL_GetAudioPlaybackDevices() and SDL_GetAudioRecordingDevices() follow the SDL_GetStringRule
2024-07-19 12:22:03 -07:00
Sam Lantinga
f95ecac300
Added SDL_ClaimEventMemory()
2024-07-19 12:22:03 -07:00
Sam Lantinga
2816745f48
Allow passing a pointer to SDL_FreeEventMemory()
...
Also clarify in the documentation that you should not call SDL_FreeEventMemory(NULL) from your main thread.
2024-07-19 12:22:03 -07:00
Sam Lantinga
02a072a1b7
Added SDL_ClearSurface() and SDL_ReadSurfacePixelFloat()
2024-07-17 18:04:16 -07:00
Sam Lantinga
334962b056
Enhancements for SDL_PremultiplyAlpha()
...
The function can now convert between pixels of different formats, and takes a parameter to control whether the premultiplication is done in sRGB or linear space.
Also added SDL_PremultiplySurfaceAlpha(), which can premultiply the pixels of a surface in-place.
2024-07-17 18:04:16 -07:00
Sam Lantinga
5f5e91eab6
Reverted 3d2e5a0b66
...
Applying these changes to external code doesn't actually improve anything, and within the context of the other Get* functions for renderers and surfaces, these stand out as outliers, so I'm going to back this change out.
2024-07-17 10:27:37 -07:00
Sam Lantinga
3d2e5a0b66
Fixed a few remaining functions to directly return their values instead of an error code.
2024-07-16 21:32:17 -07:00
Sam Lantinga
b7ec2119dd
Use a dither palette when converting RGB images to indexed formats
2024-07-16 17:57:12 -07:00
Ryan C. Gordon
4dda785c69
gamepad: Several gamepad mapping functions now follow the SDL_GetStringRule.
...
Reference Issue #10229 .
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
ed1f93cd11
filesystem: SDL_Glob*Directory()
functions now follow the SDL_GetStringRule.
...
Reference Issue #10229 .
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
52bf7ff42d
filesystem: SDL_GetPrefPath() now follows the SDL_GetStringRule.
...
Reference Issue #10229 .
2024-07-16 16:44:36 -04:00