Commit Graph

3233 Commits

Author SHA1 Message Date
Kaktus514 3586df3151 Prefer downscaling in SDL_GetSurfaceImage.
This implements the ideas described in  #10536
2024-08-15 07:28:31 -07:00
Sam Lantinga 1a729251ad Added references to SDL_GetPixelFormatDetails() from the SDL_*RGB functions 2024-08-12 09:22:59 -07:00
Ryan C. Gordon 871d0074d2
SDL_GLattr: Added some documentation from SDL2. 2024-08-12 01:33:05 -04:00
Ryan C. Gordon bec701dd04
pen: Add support for tangential pressure axis. 2024-08-11 18:00:13 -04:00
SDL Wiki Bot a7fa375275 Sync SDL3 wiki -> header 2024-08-10 02:09:54 +00:00
Ryan C. Gordon a9d70dbacb pen: Rework public API.
This changes the API in various ways, and updates the backends for this.

Overall, this is a massive simplification of the API, as most future backends
can't support the previously-offered API.

This also removes the testautomation pen code (not only did these interfaces
change completely, it also did something no other test did: mock the internal
API), and replaces testpen.c with a different implementation (the existing
code was fine, it was just easier to start from scratch than update it).
2024-08-09 22:09:23 -04:00
SDL Wiki Bot 78b1e0e299 Sync SDL3 wiki -> header 2024-08-09 16:57:18 +00:00
Sam Lantinga c2085dad8f Added SDL_HINT_JOYSTICK_GAMEINPUT 2024-08-09 09:56:47 -07:00
Sam Lantinga 4cc3410dce Added SDL_GetAudioFormatName()
Fixes https://github.com/libsdl-org/SDL/issues/10489
2024-08-08 15:05:37 -07:00
SDL Wiki Bot d2bdfd7792 Sync SDL3 wiki -> header 2024-08-08 17:56:53 +00:00
Frank Praznik ae8065e1ec Use more stringent criteria for entering warp emulation mode
Require more than one warp to the window center within a certain timespan (currently 30ms, but can be tweaked) to better avoid erroneously entering warp emulation mode.

This also correctly resets the warp emulation mode activation if the window loses and regains focus.
2024-08-08 10:56:20 -07:00
Sam Lantinga 058781f514 Include GameInput.h as gameinput.h for compatibility with non-MSVC toolchains 2024-08-08 09:14:38 -07:00
Anonymous Maarten 8714de9f46 SDL_GetAudioStreamAvailable and SDL_GetAudioStreamAvailable return error codes 2024-08-08 10:11:39 +00:00
Sam Lantinga a38cd7a067 Added checks for GameInput.h to the build system 2024-08-07 17:57:33 -07:00
SDL Wiki Bot 212f7cc355 Sync SDL3 wiki -> header 2024-08-07 19:19:43 +00:00
Sam Lantinga 001dbc5da8 Added support for raw mouse and keyboard using GameInput on Windows
Fixes https://github.com/libsdl-org/SDL/issues/10442
2024-08-07 12:19:09 -07:00
Sylvain 20a6193eaa Run test suites and test cases in non-linear order (see libsdl-org#9303) 2024-08-07 10:25:30 +02:00
SDL Wiki Bot 8a3bb11024 Sync SDL3 wiki -> header 2024-08-06 17:17:11 +00:00
SDL Wiki Bot 1ecf05be93 Sync SDL3 wiki -> header 2024-08-06 17:12:54 +00:00
Anonymous Maarten 0fa2049fef
Document iconv functions + add testautomation (#10131)
* stdinc: document SDL_iconv* functions
* iconv: add automation tests
* iconv: don't potentially crash on invalid inputs
2024-08-06 10:12:25 -07:00
SDL Wiki Bot 57fa3bc08e Sync SDL3 wiki -> header 2024-08-06 15:00:23 +00:00
Sam Lantinga 627cb8acd0 SDL_EventFilter functions now return SDL_bool 2024-08-06 07:59:45 -07:00
Sam Lantinga 57f9c6f7bb Renamed SDL_Get/SetRelativeMouseMode to SDL_Get/SetWindowRelativeMouseMode()
Fixes https://github.com/libsdl-org/SDL/issues/10041
2024-08-06 07:59:45 -07:00
Sam Lantinga a1998d106d Putting the simple back into Simple DirectMedia Layer 2024-08-05 21:20:26 -07:00
SDL Wiki Bot 0d3db8390d Sync SDL3 wiki -> header 2024-08-06 02:47:18 +00:00
Sam Lantinga afec46dbee Re-added SDL_GetScancodeFromKey() 2024-08-05 19:46:45 -07:00
Sam Lantinga a13c993e40 Removed keymaps from the API
This is unnecessary complication for applications. We can always add it again later if we find that it's really useful.
2024-08-05 19:46:45 -07:00
SDL Wiki Bot 1966472f73 Sync SDL3 wiki -> header 2024-08-06 00:02:59 +00:00
Sam Lantinga c298a3749b Expose the keymap separately from the event keycode
This adds functions to query the keymap:
* SDL_GetCurrentKeymap()
* SDL_GetKeymapKeycode()
* SDL_GetKeymapScancode()
* SDL_ReleaseKeymap()

and these are distinct from the function to query the event keycode associated with a scancode, which might be affected by SDL_HINT_KEYCODE_OPTIONS.

Also added an SDL_bool parameter to SDL_GetKeyName() and SDL_GetKeyFromName() to enable upper case handling of the name.
2024-08-05 17:02:25 -07:00
Sam Lantinga d223264f17 Updated the documentation for SDL_HINT_KEYCODE_OPTIONS 2024-08-05 10:17:48 -07:00
SDL Wiki Bot ad27d73a19 Sync SDL3 wiki -> header 2024-08-05 16:03:59 +00:00
Sam Lantinga 6161c437c7 Added SDL_SetLogPriorityPrefix()
SDL_Log() no longer prints a log prefix by default for SDL_LOG_PRIORITY_INFO and below. The log prefixes can be customized with SDL_SetLogPriorityPrefix().
2024-08-05 09:02:50 -07:00
Ryan C. Gordon 074dd8c35f
hints: Change hints to be backed by Properties, add documentation. (#9892)
This makes the subsystem thread-safe, more performant, and cleans up the code a little.

Also removed SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, since setting this hint programmatically initializes properties, which creates a lock, so we can't check hints while creating locks. The slim reader-writer locks have been the default for ages and are solid, so we'll just use those when available.
2024-08-05 09:02:28 -07:00
SDL Wiki Bot e3682995f5 Sync SDL3 wiki -> header 2024-08-05 15:54:41 +00:00
Sam Lantinga 746b8eb14b Added SDL_HINT_MUTE_CONSOLE_KEYBOARD 2024-08-05 08:54:10 -07:00
Sam Lantinga afde1cc9c2 Added SDL_HINT_EVDEV_DEVICES 2024-08-05 08:54:10 -07:00
Sam Lantinga 0da346f129 Added SDL_HINT_HIDAPI_LIBUSB, SDL_HINT_HIDAPI_LIBUSB_WHITELIST, and SDL_HINT_HIDAPI_UDEV 2024-08-05 08:54:10 -07:00
Sam Lantinga d9f9e9e764 Added SDL_HINT_VIDEO_DUMMY_SAVE_FRAMES and SDL_HINT_VIDEO_OFFSCREEN_SAVE_FRAMES 2024-08-05 08:54:10 -07:00
Sam Lantinga a97dadf779 Added hints to replace environment variables on the PlayStation Vita 2024-08-05 08:54:10 -07:00
Sam Lantinga 3669d1e76a Added SDL_HINT_VULKAN_DISPLAY 2024-08-05 08:54:10 -07:00
Sam Lantinga 997df06320 Added SDL_HINT_X11_XCB_LIBRARY 2024-08-05 08:54:10 -07:00
Sam Lantinga 175f28f59f Added SDL_HINT_VIDEO_X11_NODIRECTCOLOR 2024-08-05 08:54:10 -07:00
Sam Lantinga 8cde570ad9 Added SDL_HINT_VIDEO_X11_VISUALID 2024-08-05 08:54:10 -07:00
Sam Lantinga 05f870f20d Added SDL_HINT_OPENGL_LIBRARY and SDL_HINT_VULKAN_LIBRARY 2024-08-05 08:54:10 -07:00
Sam Lantinga c9b2bfa7c1 Added SDL_HINT_AUDIO_DISK_INPUT_FILE, SDL_HINT_AUDIO_DISK_OUTPUT_FILE, and SDL_HINT_AUDIO_DISK_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga e1ee0e748d Added SDL_HINT_WAVE_CHUNK_LIMIT 2024-08-05 08:54:10 -07:00
Sam Lantinga f05cd85048 Added SDL_HINT_AUDIO_ALSA_DEFAULT_DEVICE 2024-08-05 08:54:10 -07:00
Sam Lantinga 71574ac985 Added SDL_HINT_AUDIO_DUMMY_TIMESCALE 2024-08-05 08:54:10 -07:00
Sam Lantinga 5aa1a48ac3 Added SDL_HINT_AUDIO_FREQUENCY, SDL_HINT_AUDIO_CHANNELS, and SDL_HINT_AUDIO_FORMAT 2024-08-05 08:54:10 -07:00
Sam Lantinga 0a6bab3ac7 Added SDL_CreateRenderer to the "see also" for SDL_RenderPresent() 2024-08-05 07:56:29 -07:00
SDL Wiki Bot 6212497ea3 Sync SDL3 wiki -> header 2024-08-05 03:00:45 +00:00
Sam Lantinga b1af91e788 Clarified timer documentation
Fixes https://github.com/libsdl-org/SDL/issues/10079
2024-08-04 19:44:13 -07:00
SDL Wiki Bot a699ff2419 Sync SDL3 wiki -> header 2024-08-04 17:49:28 +00:00
Sam Lantinga bc1c3f826f Added SDL_HINT_LOGGING documentation to the logging category page.
Fixes https://github.com/libsdl-org/SDL/issues/10335
2024-08-04 10:48:42 -07:00
SDL Wiki Bot 454c85ad51 Sync SDL3 wiki -> header 2024-08-04 17:39:54 +00:00
Sam Lantinga 6da4278d37 Clarify how to check for EOF in SDL_ReadIO() documentation.
Fixes https://github.com/libsdl-org/SDL/issues/8564
2024-08-04 10:37:51 -07:00
Sam Lantinga ef6521aee7 testnative: print events with --info event 2024-08-04 09:07:19 -07:00
SDL Wiki Bot cb440ec4a4 Sync SDL3 wiki -> header 2024-08-03 13:40:37 +00:00
Sam Lantinga cd5f0d2cce Added SDL_RectToFRect() 2024-08-03 06:40:06 -07:00
SDL Wiki Bot 2f24e9c2f2 Sync SDL3 wiki -> header 2024-08-03 13:30:08 +00:00
SDL Wiki Bot b5c0921196 Sync SDL3 wiki -> header 2024-08-03 02:37:43 +00:00
Anonymous Maarten f57c597c60 Added SDL_GetWindowFromEvent 2024-08-03 02:37:11 +00:00
SDL Wiki Bot e058aa6d65 Sync SDL3 wiki -> header 2024-08-02 21:50:11 +00:00
Sam Lantinga 50492e1d03 Change the text input defaults to match the natural input experience 2024-08-02 14:49:37 -07:00
Sam Lantinga 81f8e6aba6 Added SDL_StartTextInputWithProperties()
This allows you to customize the text input so you can have numeric text entry, hidden passwords, etc.

Fixes https://github.com/libsdl-org/SDL/issues/7101
Fixes https://github.com/libsdl-org/SDL/issues/7965
Fixes https://github.com/libsdl-org/SDL/issues/9439
2024-08-02 14:49:37 -07:00
SDL Wiki Bot f01d4278c6 Sync SDL3 wiki -> header 2024-08-01 20:49:00 +00:00
Sam Lantinga 31ed3665ad Added support for high-DPI cursors and icons
Fixes https://github.com/libsdl-org/SDL/issues/9838
2024-08-01 13:48:28 -07:00
Sam Lantinga 94d9229ce2 Added SDL_AddSurfaceAlternateImage(), SDL_SurfaceHasAlternateImages(), SDL_GetSurfaceImages() and SDL_RemoveSurfaceAlternateImages()
These functions allow you to create surfaces with alternate high DPI content, and will be used for high DPI icon and cursor support.
2024-08-01 13:48:28 -07:00
Sam Lantinga 22ffb487d0 Added SDL_ScaleSurface() 2024-08-01 13:48:28 -07:00
Anonymous Maarten 68fb07787b cmake: Remove HAVE_D3D12_H from sources and introduce SDL_RENDER_D3D(11|12) 2024-08-01 17:49:02 +00:00
SDL Wiki Bot 2e058ba7a4 Sync SDL3 wiki -> header 2024-08-01 05:37:11 +00:00
Sam Lantinga a5f18048b2 Extend the 9-grid functions to handle a non-uniform grid layout (thanks @zaun!)
Fixes https://github.com/libsdl-org/SDL/issues/10389
2024-07-31 22:36:39 -07:00
Sam Lantinga a6407e88da Document the events that need to be handled in a callback 2024-07-30 07:52:13 -07:00
Sam Lantinga 691cf15e75 Removed the ancient Android audio driver
OpenSLES is well supported on Android 4.0 and later.
2024-07-29 08:05:36 -07:00
SDL Wiki Bot 3b01a0b884 Sync SDL3 wiki -> header 2024-07-29 11:26:36 +00:00
Sam Lantinga 61a88077a7 Re-added SDL_HINT_APP_ID and SDL_HINT_APP_NAME 2024-07-29 07:26:03 -04:00
Sam Lantinga 383ccb2b6a Finish removing SDL_DECLSPEC_FREE 2024-07-28 08:06:20 -07:00
Sam Lantinga 728bf363cb Make sure we call SDL_Quit() before SDLTest_CommonDestroyState()
Otherwise we'll report leaks that will be cleaned up in SDL_Quit()
2024-07-28 08:05:31 -07:00
Sam Lantinga b5ad74998b Removed SDL_DECLSPEC_FREE 2024-07-28 07:24:21 -07:00
SDL Wiki Bot 18fe89e036 Sync SDL3 wiki -> header 2024-07-28 14:23:13 +00:00
Sam Lantinga a36fe632fd
Added SDL_SetAppMetadata() (#10404)
Removed duplicate hints SDL_HINT_APP_NAME, SDL_HINT_APP_ID, and
SDL_HINT_AUDIO_DEVICE_APP_NAME.

Wired up a few things to use the metadata; more to come!

Fixes https://github.com/libsdl-org/SDL/issues/4703
2024-07-28 07:22:46 -07:00
Sam Lantinga 473feab2a4 Added SDL_unsetenv() 2024-07-27 09:10:08 -07:00
Anonymous Maarten 3374e57102 stdinc: strcasecmp is declared in strings.h 2024-07-27 15:19:20 +00:00
SDL Wiki Bot 0f2fc2fbaa Sync SDL3 wiki -> header 2024-07-27 03:59:43 +00: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
SDL Wiki Bot 2137e6eed1 Sync SDL3 wiki -> header 2024-07-26 17:05:33 +00: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
Eduard Gushchin 2f38a4bf5e Fixed a typo in the link to the GetTouchFingers function 2024-07-26 07:59:08 -07:00
SDL Wiki Bot a1a8278029 Sync SDL3 wiki -> header 2024-07-26 00:47:35 +00:00
Sam Lantinga 750aef2bee Clarified that temporary memory shouldn't be kept beyond the current function scope or event handling. 2024-07-25 17:47:00 -07:00
SDL Wiki Bot a880410cb2 Sync SDL3 wiki -> header 2024-07-25 23:58:09 +00:00
Frank Praznik 66eb2ea443 mouse: Make pointer warp emulation via relative mode available to all platforms
Move the Wayland pointer warp emulation code up to the SDL mouse layer, and activate it when a client attempts to warp a hidden mouse cursor when the hint is set.

testrelative adds the ability to test the warp emulation activation/deactivation with the --warp parameter and 'c' key for toggling cursor visibility.
2024-07-25 19:57:39 -04:00
Eduard Gushchin 92667e3066 Update SDL_keycode.h
Removed the link referring to yourself
2024-07-25 14:12:04 -07:00
Eduard Gushchin 3ee59359c4 Fix documentation references and update method usage for SDL_GetGamepadGUIDForID in SDL_gamepad.h
In the documentation for the SDL_GetGamepadGUIDForID method in the SDL_gamepad.h file, there are two references to the methods SDL_GetGamepadGUID and SDL_GetGamepadGUIDString, but there are no methods of its own. I replaced these two methods with the existing SDL_GUIDToString.
2024-07-25 11:43:41 -07:00
SDL Wiki Bot ba8495c214 Sync SDL3 wiki -> header 2024-07-25 00:41:44 +00:00
Sam Lantinga cf8b158ccb Added SDL_GetRenderSafeArea() 2024-07-24 17:40:41 -07:00
Sam Lantinga b98e1e9ef0 Fixed the render viewport not updating when the metal view resizes
When the phone is in portrait mode and the window is in landscape mode, the view changes orientation after layoutSubviews runs. In this case we need some way of notifying the application that the Metal view has changed.
2024-07-24 16:12:29 -07:00
Sam Lantinga f562a6d9f7 Added Android API level 35 to the table 2024-07-24 14:09:54 -07:00
Sam Lantinga a7c0192017 Renamed SDL_PostSemaphore() to SDL_SignalSemphore() 2024-07-24 13:37:40 -07:00
Sam Lantinga ca4bd4b63c Android life cycle behavior more closely matches iOS
This change also decouples the pause/resume handling from the video subsystem on Android, so applications that don't use SDL for video can get application life cycle events.

The semantics for the life cycle events are that they need to be handled in an event watch callback, and once they've been delivered, the application will block until it's been resumed. SDL_HINT_ANDROID_BLOCK_ON_PAUSE can be used to control that behavior, and if that's set to "0", then the application will continue to run in the background at low CPU usage until being resumed or stopped.

SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO has been removed, and the audio will be paused when the application is paused.

Fixes https://github.com/libsdl-org/SDL/issues/3193
2024-07-24 05:11:13 -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 f0363a0466 Functions that return display modes return temporary memory.
Also use the real pointer to display modes for internal mode processing

Fixes https://github.com/libsdl-org/SDL/issues/10353
2024-07-23 19:26:19 -07:00
SDL Wiki Bot 10dcae784b Sync SDL3 wiki -> header 2024-07-24 00:07:31 +00:00
Sam Lantinga 457ca3995c Added SDL_GetWindowSafeArea()
Fixes https://github.com/libsdl-org/SDL/issues/3243
2024-07-23 17:06:04 -07:00
SDL Wiki Bot 230161a50c Sync SDL3 wiki -> header 2024-07-23 22:49:23 +00:00
Sam Lantinga 66011e497d Removed duplication in SDL_EGL_* function names 2024-07-23 13:11:37 -07:00
Eduard Gushchin 86934975b9 Update SDL_video.h
Fixed a typo in the function name in the documentation for SDL_EGL_GetProcAddress
2024-07-23 12:48:10 -07:00
SDL Wiki Bot 2aea74aa84 Sync SDL3 wiki -> header 2024-07-22 22:19:38 +00:00
Sam Lantinga a36be94ad1 More clarification on temporary memory 2024-07-22 15:19:26 -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
SDL Wiki Bot 5e12706ae0 Sync SDL3 wiki -> header 2024-07-22 17:05:52 +00:00
Eduard Gushchin 24bb95f60c Fixed a typo in the name of the method in the documentation for SDL_GetDisplayProperties 2024-07-22 10:04:59 -07:00
Sam Lantinga c4bf5f9f59 SDL_CreateTexture() uses the SDL_TextureAccess type for the access parameter 2024-07-22 09:32:02 -07:00
SDL Wiki Bot 3e943090d0 Sync SDL3 wiki -> header 2024-07-22 14:50:48 +00:00
Eduard Gushchin 61565b7f61 Update SDL_video.h
Led to the actual list of WindowsFlag in the documentation of the SDL_CreateWindow method
2024-07-22 07:50:07 -07:00
SDL Wiki Bot 40cb3fb74a Sync SDL3 wiki -> header 2024-07-22 14:35:35 +00: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
Ozkan Sezer 70c1012e8c SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR/10331)
Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: https://github.com/libsdl-org/SDL/issues/6078 which was fixed by
f6b81125b3
2024-07-22 16:00:37 +03:00
SDL Wiki Bot 230f2a684d Sync SDL3 wiki -> header 2024-07-22 12:59:19 +00:00
Sam Lantinga 685e381735 Add an overview of how to handle temporary memory 2024-07-22 05:58:19 -07:00
Sam Lantinga 9bfd0d901c Audio device IDs are unsigned 2024-07-22 05:48:01 -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
Anonymous Maarten 22bfbdbc02 stdinc: c23 deprecated _Static_assert in favor of static_assert 2024-07-21 21:51:55 +03:00
Sam Lantinga c040a02d6c Removed SDL_PROP_SURFACE_COLORSPACE_NUMBER
Now that we have surface internal data, we can store it there. This slightly improves performance in the surface blitting paths.
2024-07-21 09:36:22 -07:00
SDL Wiki Bot 4a7e95402f Sync SDL3 wiki -> header 2024-07-21 15:09:24 +00:00
Sam Lantinga e0fd59de64 Fixed floating point rectangles to be mathematically correct.
* A floating point rectangle contains all points >= x and <= x + w
* A floating point rectangle is only empty if it has negative width. The zero rectangle contains the zero point.
* Adjacent floating point rectangles intersect along their shared side

Fixes https://github.com/libsdl-org/SDL/issues/6791
2024-07-21 08:08:15 -07:00
Sam Lantinga b0a6afaa35 Updated documentation for SDL_GetPreferredLocales() 2024-07-20 20:12:55 -07:00
SDL Wiki Bot 979c71b18b Sync SDL3 wiki -> header 2024-07-21 01:22:39 +00: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 5ce81ebcc9 Corrected blit colorkey documentation
Fixes https://github.com/libsdl-org/sdlwiki/issues/576
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
hwsmm 6a62c54b93 Remove a duplicate definition that is already in SDL_guid.h 2024-07-20 12:23:50 +03:00
Anonymous Maarten 476b987f1b intrinsics: avx, avx2 and avx512f are (currently) unsupported on arm64ec 2024-07-20 00:59:58 +02:00
Sam Lantinga f0a839b9b7 Removed SDL 2.1 note, we're not going to revisit this for SDL 3.0
Closes https://github.com/libsdl-org/SDL/issues/9480
2024-07-19 13:39:22 -07:00
SDL Wiki Bot fc8cd657a5 Sync SDL3 wiki -> header 2024-07-19 20:08:05 +00:00
Sam Lantinga b80784fced SDL_GetGamepadBindings() follows the SDL_GetStringRule 2024-07-19 13:06:54 -07:00
Sam Lantinga 93db5ef135 Fixed documentation for SDL_GlobDirectory() 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
SDL Wiki Bot 975457cfb6 Sync SDL3 wiki -> header 2024-07-19 19:23:24 +00:00
Sam Lantinga 71a60d4c0e Updated documentation for functions that return temporary memory 2024-07-19 12:22:03 -07:00
Sam Lantinga 68322ac851 Ensure that all functions that follow the SDL_GetStringRule return temporary memory 2024-07-19 12:22:03 -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 637e9700dd Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
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 ef884c8aa6 Transfer event memory between the local pool and the event queue
This allows threads to free memory from their local pool without affecting events that are queued, and to transfer memory ownership cleanly between threads that are queuing and dequeuing events.
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 217330a7b3 Made return value descriptions more consistent across the API 2024-07-19 12:22:03 -07:00
Sam Lantinga d73c7311d5 Clarify that the SDL_GetStringRule means that SDL will automatically free the memory later. 2024-07-19 12:22:03 -07:00
SDL Wiki Bot e949f12f63 Sync SDL3 wiki -> header 2024-07-18 01:04:46 +00:00
Sam Lantinga 02a072a1b7 Added SDL_ClearSurface() and SDL_ReadSurfacePixelFloat() 2024-07-17 18:04:16 -07:00
Sam Lantinga de6595bda6 SDL_MUSTLOCK() should return true if the surface needs locking even if it's currently locked.
There's a bunch of code that assumes this in SDL, and presumably in applications as well.
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
Frank Praznik b99ea1ff75
wayland: Add SDL_VIDEO_DOUBLE_BUFFER support
Manual cherry-pick of 9e6b8d56e3

thanks @vanfanel
2024-07-17 18:27:46 -04: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 8c25129458 SDL_EVENT_WINDOW_LAST should be SDL_EVENT_WINDOW_HDR_STATE_CHANGED
Fixes https://github.com/libsdl-org/SDL/issues/10299
2024-07-16 22:43:02 -07:00
SDL Wiki Bot b92ec25147 Sync SDL3 wiki -> header 2024-07-17 04:33:30 +00: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
Sam Lantinga 9ca1792848 Renamed driverdata to internal
This was done to SDL_DisplayMode for consistency with SDL_Surface and gives it a type so we don't have to do casts in SDL code.

I considered switching to an ID and hashing the driver data, etc. but all of that involved a lot of internal code churn and this solution gives us flexibility in how we handle this in the future.

After consideration, I made this renaming global across the project, for consistency.

Fixes https://github.com/libsdl-org/SDL/issues/10198
2024-07-16 17:17:13 -07:00
SDL Wiki Bot fe183872ee Sync SDL3 wiki -> header 2024-07-16 20:45:34 +00: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
Ryan C. Gordon 2321726ff1 filesystem: SDL_GetUserFolder() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon d40b89dff6 clipboard: SDL_GetPrimarySelectionText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon 158fc459f1 clipboard: SDL_GetClipboardText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon 3bc81a81f5 filesystem: SDL_GetBasePath() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

A little code hygiene work was applied to some of the platform bits on top of
this.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00
SDL Wiki Bot d65a8146b9 Sync SDL3 wiki -> header 2024-07-16 19:03:15 +00:00
Sam Lantinga 4aeabb3c3b Made event and temporary string memory thread-local and added SDL_FreeEventMemory()
Fixes https://github.com/libsdl-org/SDL/issues/10283
2024-07-16 12:01:51 -07:00
Sam Lantinga ec3bb4c029 Removed the need for SDL_CreateTLS()
This eliminates the tap dancing needed for allocating TLS slots, we'll automatically allocate them as needed, in a thread-safe way.
2024-07-16 12:01:51 -07:00
SDL Wiki Bot 70727d36b2 Sync SDL3 wiki -> header 2024-07-16 16:37:08 +00:00
Sam Lantinga 027671bedb SDL_GetWindowOpacity() directly returns the opacity instead of using an out parameter.
Fixes https://github.com/libsdl-org/SDL/issues/10286
2024-07-16 09:36:11 -07:00
Sam Lantinga 58270ef3f2 Finished renaming functions in SDL_system.h 2024-07-16 09:35:49 -07:00
SDL Wiki Bot 4ac67f5ba6 Sync SDL3 wiki -> header 2024-07-16 01:38:55 +00:00
Sam Lantinga 033df70d4c SDL_DelayNS() will attempt to sleep exactly the requested amount of time
This provides a highly accurate sleep function for your application, although you are still subject to being switched out occasionally.

Fixes https://github.com/libsdl-org/SDL/issues/10210
2024-07-15 18:38:09 -07:00
Sam Lantinga 54366181c3 Rename functions in SDL_system.h to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/10277
2024-07-15 16:27:48 -07:00
Sam Lantinga 70c8fe61d7 Align SDL_BLENDMODE_INVALID with the other constants 2024-07-15 15:00:09 -07:00
Sam Lantinga bf501ab2d4 Made the SDL_BlendMode values wiki-friendly 2024-07-15 14:46:56 -07:00
Sam Lantinga df573391b1 Added SDL_BLENDMODE_BLEND_PREMULTIPLIED and SDL_BLENDMODE_ADD_PREMULTIPLIED
Fixes https://github.com/libsdl-org/SDL/issues/2485
2024-07-15 14:12:33 -07:00
SDL Wiki Bot 9406a9d527 Sync SDL3 wiki -> header 2024-07-14 23:42:33 +00:00
Sam Lantinga 5c875e1183 Renamed *FromID() to *ForID()
While it makes sense to get an object pointer from an object ID, you want to get object attributes for an ID, otherwise e.g. GetNameFromID() sounds like it's a name ID, not an object ID. This is also consistent with the function naming convention in SDL2.
2024-07-14 15:56:50 -07:00
SDL Wiki Bot 0cdc60666b Sync SDL3 wiki -> header 2024-07-14 21:04:37 +00:00
Ryan C. Gordon f61900465c
stdinc: Fixed up documentation details for standard types. 2024-07-14 17:03:15 -04:00
SDL Wiki Bot cb854d1bc9 Sync SDL3 wiki -> header 2024-07-14 20:02:23 +00:00
Sam Lantinga 9797c5d0c0 Renamed CameraDevice to Camera
This is consistent with the rest of the SDL API
2024-07-14 13:01:53 -07:00
Sam Lantinga 9358333286 Renamed SDL_GetKeyboardInstanceName() and SDL_GetMouseInstanceName()
For consistency with other device APIs
2024-07-14 13:01:53 -07:00
Sam Lantinga d154b37b41 Renamed *FromInstanceID() to *FromID() 2024-07-14 13:01:53 -07:00
Sam Lantinga cad9e6ea20 Fixed SDL_SINT64_C typo
Apparently all the platforms we compile on have INT64_C defined?

Fixes https://github.com/libsdl-org/SDL/issues/10268
2024-07-14 12:53:32 -07:00
Ryan C. Gordon 90e69f81e5
SDL_hidapi.h: Fixed something that apparently upset wikiheaders. 2024-07-14 15:20:26 -04:00
Ryan C. Gordon 15f850babc
SDL_hidapi.h: remove struct predeclaration before typedef. 2024-07-14 15:18:08 -04:00
Sam Lantinga a17b742e34 Added documentation references to the components of a colorspace 2024-07-14 11:43:39 -07:00
SDL Wiki Bot abaef81615 Sync SDL3 wiki -> header 2024-07-14 18:04:00 +00:00
Sam Lantinga 6217094c40 Updated colorspace documentation for the wiki 2024-07-14 11:02:56 -07:00
Sam Lantinga 1fecef5e4b Assign numeric values to pixel format enums
This makes it easier to generate language bindings for these.
2024-07-14 11:02:56 -07:00
Sam Lantinga cb395f7e80 Change SDL_AudioFormat into an enum
This makes it easier to understand in the debugger, and is consistent with SDL_PixelFormat and SDL_Colorspace
2024-07-14 10:04:31 -07:00
Sam Lantinga e90060d07f Renamed functions to get information from device IDs
Fixes https://github.com/libsdl-org/SDL/issues/10237
2024-07-14 09:03:59 -07:00
Sam Lantinga bfee544685 Changed SDL_GetWindowPixelFormat() to return SDL_PixelFormat
Fixes https://github.com/libsdl-org/SDL/issues/10257
Closes https://github.com/libsdl-org/SDL/pull/10258
2024-07-14 07:19:20 -07:00
SDL Wiki Bot 2596482c3f Sync SDL3 wiki -> header 2024-07-13 21:32:39 +00:00
Sam Lantinga 650271af46 Added SDL_CreateSurfacePalette() 2024-07-13 14:31:28 -07:00
captain0xff 0506cf18ab android: enable vulkan renderer 2024-07-13 08:16:26 -07:00
Sam Lantinga 730d5cf2f8 Added fractional representation of refresh rate to SDL_DisplayMode 2024-07-12 18:09:14 -07:00
Sam Lantinga 1162a1cb8e Added SDL_EVENT_DISPLAY_DESKTOP_MODE_CHANGED and SDL_EVENT_DISPLAY_CURRENT_MODE_CHANGED 2024-07-12 18:09:14 -07:00
SDL Wiki Bot 3f446a12df Sync SDL3 wiki -> header 2024-07-12 19:42:55 +00:00
Ryan C. Gordon 8779c95905 android: Added SDL_AndroidGetCachePath().
Fixes #8408.
2024-07-12 15:41:54 -04:00
SDL Wiki Bot d949673bc9 Sync SDL3 wiki -> header 2024-07-12 18:25:57 +00:00
Sam Lantinga 4c88ddf86d More property documentation clarification 2024-07-12 11:24:40 -07:00
SDL Wiki Bot cf441332c4 Sync SDL3 wiki -> header 2024-07-12 18:21:05 +00:00
Sam Lantinga 0e56f6a3ca Clarify property group documentation
Fixes https://github.com/libsdl-org/SDL/issues/10241
2024-07-12 11:20:15 -07:00
SDL Wiki Bot d6fe06bb5d Sync SDL3 wiki -> header 2024-07-12 17:42:22 +00:00
Sam Lantinga 5bf6bc4d7d Renamed SDL_Get/SetProperty() to SDL_Get/SetPointerProperty()
This is consistent with the naming for the functions that affect other data types

Fixes https://github.com/libsdl-org/SDL/issues/10241
2024-07-12 10:41:02 -07:00
Ryan C. Gordon bf03dee866
Remove `struct SDL_Camera` predeclare.
This is unnecessary and confuses the wiki bridge.
2024-07-12 13:25:06 -04:00
SDL Wiki Bot f531003776 Sync SDL3 wiki -> header 2024-07-12 15:37:23 +00:00
SDL Wiki Bot 68dfae1322 Sync SDL3 wiki -> header 2024-07-12 15:35:05 +00:00
Sam Lantinga 282cf286fc SDL_GetPixelFormatName() returns a string 2024-07-12 05:59:45 -07:00
SDL Wiki Bot 50589cbff6 Sync SDL3 wiki -> header 2024-07-12 12:33:26 +00:00
SDL Wiki Bot f0ceb92dca Sync SDL3 wiki -> header 2024-07-11 19:01:27 +00:00
Ethan Lee 1993ef664e Add SDL_Vulkan_GetPresentationSupport 2024-07-11 15:00:59 -04:00
Ryan C. Gordon af2dbf3ff3 video: Rename SDL_GL_DeleteContext to SDL_GL_DestroyContext.
Turns out that there isn't a strong OpenGL naming convention for "Delete" ...
WGL offers "wglDeleteContext" but the GLX equivalent is "glxDestroyContext"
and then EGL sealed the deal by going with Destroy as well! Since it matches
SDL3 naming conventions (Create/Destroy), we're renaming it.

Fixes #10197.
2024-07-10 15:54:08 -04:00
SDL Wiki Bot 29b0076659 Sync SDL3 wiki -> header 2024-07-10 19:45:01 +00:00
Ryan C. Gordon 4755055bc3 audio: Separate channel maps out of SDL_AudioSpec. 2024-07-10 15:43:57 -04:00
SDL Wiki Bot fdc04708f1 Sync SDL3 wiki -> header 2024-07-10 07:48:48 +00:00
Sam Lantinga 2ba76dbe80 Simplified SDL_Surface
SDL_Surface has been simplified and internal details are no longer in the public structure.

The `format` member of SDL_Surface is now an enumerated pixel format value. You can get the full details of the pixel format by calling `SDL_GetPixelFormatDetails(surface->format)`. You can get the palette associated with the surface by calling SDL_GetSurfacePalette(). You can get the clip rectangle by calling SDL_GetSurfaceClipRect().

SDL_PixelFormat has been renamed SDL_PixelFormatDetails and just describes the pixel format, it does not include a palette for indexed pixel types.

SDL_PixelFormatEnum has been renamed SDL_PixelFormat and is used instead of Uint32 for API functions that refer to pixel format by enumerated value.

SDL_MapRGB(), SDL_MapRGBA(), SDL_GetRGB(), and SDL_GetRGBA() take an optional palette parameter for indexed color lookups.
2024-07-10 00:48:18 -07:00
Sam Lantinga 4fa5196820 Revert "Switch pixel format loss fields to number of bits"
This reverts commit 3c90b1c1f6.

It turns out this is problematic for sdl2-compat. We're investigating a more complete separation between SDL2 and SDL3 surfaces, but in the meantime, I'll fix the breakage.
2024-07-07 19:41:05 -07:00
SDL Wiki Bot bfa4e71284 Sync SDL3 wiki -> header 2024-07-07 18:05:35 +00:00
SDL Wiki Bot e37d6f71b3 Sync SDL3 wiki -> header 2024-07-07 18:02:15 +00:00
Sam Lantinga 3c90b1c1f6 Switch pixel format loss fields to number of bits
This makes more sense and handles pixel formats with > 8 bits per channel

Fixes https://github.com/libsdl-org/SDL/issues/10168
2024-07-06 11:37:16 -07:00
SDL Wiki Bot f3ac2d9d4f Sync SDL3 wiki -> header 2024-07-06 15:46:41 +00:00