Compare commits

..
Author SHA1 Message Date
Frank Praznik b96bb152c2 wayland: Don't redundantly set the border state when showing a window
They are now set before the initial configure.
2025-01-16 13:54:39 -05:00
Frank Praznik 5a564a718d wayland: Add a dummy function for the libdecor dismiss popup callback
This was never added, and we've been lucky that it's never called as libdecor doesn't check the function pointer for null before doing so.
2025-01-16 13:48:16 -05:00
Frank Praznik 9f6eeb1095 wayland: Set the border state before the initial configure
This allows the toplevel bounds to be set correctly on borderless windows.
2025-01-16 13:40:31 -05:00
SDL Wiki Bot 274bc95dfd Sync SDL3 wiki -> header
[ci skip]
2025-01-16 18:29:57 +00:00
SDL Wiki Bot 07f7c40464 Sync SDL3 wiki -> header
[ci skip]
2025-01-16 18:18:47 +00:00
Ryan C. Gordon 22d8e73530 include: filled in category documentation for SDL_messagebox.h.
Reference Issue #11847.
2025-01-16 13:16:18 -05:00
Sam Lantinga 21a42d2b0d Add CategoryAPICategory to the complete API index 2025-01-16 09:26:00 -08:00
Anonymous Maarten 1006236aa6 ci: add summary to release.yml
[ci skip]
2025-01-16 18:24:13 +01:00
Ethan Lee 326ce9bb8d gpu: D3D12 buildfix for Xbox 2025-01-16 12:19:59 -05:00
Ethan Lee c95b842b30 video: Xbox does not use CreateIconFromSurface 2025-01-16 12:19:46 -05:00
Sam Lantinga d8e1ad0ebc release: skip extended Android SDK versions 2025-01-16 09:07:00 -08:00
Frank Praznik 7ee2ab3830 wayland: Fix return value check from int-to-bool conversion 2025-01-16 11:52:16 -05:00
Sam Lantinga 1dd8fadca2 Updated to version 3.1.10 for the release candidate 2025-01-16 08:33:18 -08:00
SDL Wiki Bot 9225a421b7 Sync SDL3 wiki -> header
[ci skip]
2025-01-16 13:20:18 +00:00
Ryan C. Gordon 3ffb1a8cbd storage: generic title storage allows override paths without '/' appended.
Fixes #11299.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon 874c07f8de storage: Don't allow "." and ".." paths, enforce '/' dir separators.
Also clarify what characters are valid for Storage paths in the category docs.

Fixes #11079.
Fixes #11370.
Fixes #11369.
2025-01-16 08:19:28 -05:00
Ryan C. Gordon 67664a0427 testfilesystem: test some Storage APIs, too. 2025-01-16 08:19:28 -05:00
Ryan C. Gordon eb793dede7 filesystem: SDL_GetCurrentDirectory() should add a path separator at the end. 2025-01-16 08:19:28 -05:00
Ryan C. Gordon 87e1b0eb89 filesystem: SDL_EnumerateDirectory() gives dirs with path seperators appended.
Fixes #11065.
Fixes #11427.
2025-01-16 08:19:28 -05:00
Ramez Ragaa e98ee9bb04 Adjust testgl.c to test gl_release_behavior 2025-01-16 08:19:05 -05:00
Ryan C. Gordon 3424ec948c video: SDL_GL_GetAttribute gets correct SDL_GL_CONTEXT_RELEASE_BEHAVIOR value.
Original patch was from @ramezgerges (thanks!).

Fixes #11697.
2025-01-16 08:19:05 -05:00
Ryan C. Gordon 05877f2cea cmake: Add the IoRing async i/o code to the Windows build.
The Visual Studio projects have been compiling this for awhile, but apparently
we haven't tested this through CMake before. Toolchains without access to
the latest Windows 11 SDK headers have been preprocessing out the dependency
on this code, so we never noticed.
2025-01-16 08:18:40 -05:00
Ryan C. Gordon 4d63a2b882 io: Renamed src/file to src/io
Fixes #11980.
2025-01-16 08:18:40 -05:00
Sam Lantinga ea642fe9ff cocoa: clear mouse focus based on NSEventTypeMouseExited events (#11991)
We can't directly set the mouse focus since we may get spammed by entered/exited events,
but we can process the current focus later in the mouseMoved handler in line with the
mouse motion event sequence.

Fixes https://github.com/libsdl-org/SDL/issues/8188
2025-01-15 23:34:20 -08:00
Sam Lantinga 5f4696ce63 Updating documentation for the 3.2.0 release
* Simplified and updated the mingw release archive

* Simplified and updated the msvc release archive

* Updated the Xcode release archive

* Updated the Android release archive
2025-01-15 20:38:16 -08:00
Sam Lantinga 2c7b7d1d33 Keep the lifecycle observer active while there are windows active
Fixes https://github.com/libsdl-org/SDL/issues/11627
2025-01-15 17:10:49 -08:00
cosmonaut 355f69ebfe GPU: Ensure thread safety of Vulkan resource creation 2025-01-15 13:45:43 -08:00
Frank Praznik c9d602307c cocoa: Only process hit tests on left clicks
Otherwise, right-click events over drag areas will be eaten.
2025-01-15 15:44:01 -05:00
Frank Praznik dd0bdc2561 win32: Pass through non-left mouse button presses when over draggable areas
Returning anything other an HTCLIENT result will cause windows to eat the button press, so ensure that non-left presses are passed through to the client over draggable areas.
2025-01-15 15:44:01 -05:00
Ryan C. Gordon 84d35587ee filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice. 2025-01-15 14:09:33 -05:00
Sam Lantinga fc9b2478d8 windows: don't set focus click pending if SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH is set
Fixes https://github.com/libsdl-org/SDL/issues/11976
2025-01-15 10:54:12 -08:00
Sam Lantinga 18d21b36fe windows: use the initial rect to anchor fixed aspect ratio resizing
Fixes https://github.com/libsdl-org/SDL/issues/11688
2025-01-15 10:33:22 -08:00
Sam Lantinga 1995471927 cocoa: fixed resizing windows with fixed aspect ratio
The existing algorithm works well for min-max ratios, but didn't allow edge expansion of fixed aspect ratio windows. Use NSWindow setContentAspectRatio instead.
2025-01-15 10:05:34 -08:00
Sam Lantinga 67382e9c83 Fixed detection of function keys on Emscripten
Fixes https://github.com/libsdl-org/SDL/issues/11973
2025-01-15 08:07:38 -08:00
Sam Lantinga 23410debf7 SDL_GetKeyboardNameForID(): Set an error message for invalid keyboard IDs 2025-01-15 00:01:06 -08:00
Petar Popovic 8ce176b59a SDL_GetMouseNameForID(): Set an error message for invalid mouse IDs. 2025-01-14 23:59:49 -08:00
Sam Lantinga 51fa076fdc Don't send normal keyboard events if no application window has focus
This can happen if all the windows shown have the SDL_WINDOW_NOT_FOCUSABLE flag. We'll still accept modifier state changes though, so you can do Control-click actions.
2025-01-14 23:44:43 -08:00
Sam Lantinga a446381ea9 Tooltips and unfocusable windows can't become main windows 2025-01-14 23:44:43 -08:00
Ryan C. Gordon ebb24eedc8 mouse: Clean up virtual touch devices as appropriate. 2025-01-15 02:19:59 -05:00
Ryan C. Gordon dabc93a631 pen: Send virtual mouse and touch events for pen input.
Fixes #11948.
2025-01-15 02:19:59 -05:00
ImThour 169c8d5140 Fix incorrect hotspot calculation for cursor positioning
Corrected the calculation of the vertical hotspot position in the `GetCachedCursor` function.

Changed the variable from `data->hot_x` to `data->hot_y` to ensure the correct vertical position of the cursor's hotspot is used when scaling.
2025-01-14 22:37:24 -08:00
Sam Lantinga 8e9c44bc3b Fixed accidental removal of optional delegate interface check
Fixes https://github.com/libsdl-org/SDL/issues/11970
2025-01-14 22:35:13 -08:00
Sam Lantinga 4dd585fb62 coreaudio: convert MPEG channel layout to WAVE channel layout 2025-01-14 22:26:16 -08:00
Sam Lantinga 81e57147f8 Child windows shouldn't take focus if the parent window is in relative mouse mode
Fixes https://github.com/libsdl-org/SDL/issues/11807 on Windows
2025-01-14 21:27:06 -08:00
SDL Wiki Bot 3bea84531d Sync SDL3 wiki -> header
[ci skip]
2025-01-15 03:27:28 +00:00
Sam Lantinga 9ed23a4b79 Updated SDL_SetEventFilter() documentation 2025-01-14 19:25:31 -08:00
Sam Lantinga e19a56f4d5 Don't send fake key events while processing real ones on Android
Fixes https://github.com/libsdl-org/SDL/issues/11350
2025-01-14 19:05:07 -08:00
Sam Lantinga 1ab61635a9 Use SDL_Log() for keyboard debugging. 2025-01-14 19:05:07 -08:00
Sam Lantinga 29c684c626 Removed debug logging 2025-01-14 18:05:37 -08:00
Sam Lantinga 0eaa6197c5 Removed unnecessary __builtin_available check 2025-01-14 17:00:30 -08:00
Sam Lantinga ffe194c52e Fixed build when SDL_JOYSTICK_MFI isn't enabled 2025-01-14 17:00:30 -08:00
Sam Lantinga a4547fe77a Updated weak framework dependencies for new deployment targets 2025-01-14 17:00:30 -08:00
Sam Lantinga 49dd24e195 Fixed potentially overlapping memcpy() to use memmove() 2025-01-14 14:31:20 -08:00
Green Sky 191a6417d5 events: use SDL_memmove instead of SDL_memcpy for overlapping memory 2025-01-14 14:20:32 -08:00
SDL Wiki Bot bf793bf439 Sync SDL3 wiki -> header
[ci skip]
2025-01-14 21:44:52 +00:00
Ryan C. Gordon 9e60a8994f audio: Allow streams to change the device-side channels maps.
Fixes #11881.
2025-01-14 16:42:53 -05:00
Sam Lantinga b2793a2ce2 Removed obsolete Raspberry Pi documentation 2025-01-14 12:58:30 -08:00
Sam Lantinga 04e3b67707 Removed outdated Visual Studio instructions 2025-01-14 12:22:15 -08:00
Sam Lantinga a41f93bd10 Added https://github.com/Ravbug/sdl3-sample as a more complete Android example 2025-01-14 12:22:00 -08:00
Sam Lantinga 5ca735b40f Only use WAVE surround sound channel layouts on macOS 10.15+ 2025-01-14 12:03:07 -08:00
Sam Lantinga cdde6dd7bb Bumped deployment requirements for Apple platforms
We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0.

This cleans up the code significantly
2025-01-14 12:03:07 -08:00
Sam Lantinga 8f8af918ba Removed CMakeLists.txt example that says you shouldn't use it 2025-01-14 11:15:34 -08:00
Sam Lantinga 8feb21a1d1 Updated README-cmake.md with build instructions for several platforms 2025-01-14 11:15:34 -08:00
cosmonaut 4294c06836 GPU: Check texture format support in pipeline creation 2025-01-14 10:16:20 -08:00
SDL Wiki Bot 31dd4fe81f Sync SDL3 wiki -> header
[ci skip]
2025-01-14 17:58:27 +00:00
Maia 417ed7f35f Fix references in docs 2025-01-14 09:56:39 -08:00
Scrooge86x 0aa319e4f9 Added support for custom tray icon on Windows via SDL hints.
SDL_CreateTray now respects SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
and SDL_HINT_WINDOWS_INTRESOURCE_ICON hints and uses the specified icon
as the tray icon.
2025-01-13 18:35:49 -08:00
Ozkan Sezer 5815372206 minor update to mingw-w64 build instructions. 2025-01-14 05:04:24 +03:00
cosmonaut 5d079c9a26 GPU: Remove bogus property from header docs 2025-01-13 17:46:31 -08:00
cosmonaut d590e1f122 GPU: Align D3D12 clear properties to naming convention 2025-01-13 17:38:21 -08:00
SDL Wiki Bot 7098e525d0 Sync SDL3 wiki -> header
[ci skip]
2025-01-14 01:30:53 +00:00
Evan Hemsley fb6df93384 GPU: Add name properties to resources (#11946) 2025-01-13 17:29:08 -08:00
SDL Wiki Bot a2b0ddcca6 Sync SDL3 wiki -> header
[ci skip]
2025-01-14 01:19:09 +00:00
Sam Lantinga d28e953222 Added thread safety documentation for SDL_iostream.h
Fixes https://github.com/libsdl-org/SDL/issues/11942
2025-01-13 17:17:17 -08:00
SDL Wiki Bot f731741ead Sync SDL3 wiki -> header
[ci skip]
2025-01-14 00:44:57 +00:00
Sam Lantinga 0eaa8c6d81 Added INTRO-emscripten.md 2025-01-13 16:42:50 -08:00
Sam Lantinga 21b433536a Scale up the text for large displays 2025-01-13 16:42:50 -08:00
Sam Lantinga 6bc7e88ca6 Added INTRO-androidstudio.md 2025-01-13 16:42:50 -08:00
Sam Lantinga e4e76ac72e Added INTRO-xcode.md 2025-01-13 16:42:50 -08:00
Sam Lantinga 1b30a01b44 Added INTRO-visualstudio.md
Also removed out of date Visual C++ documentation
2025-01-13 16:42:50 -08:00
Sam Lantinga 191b9d5021 Added INTRO-cmake.md 2025-01-13 16:42:50 -08:00
Sam Lantinga 7d2a1c5f8f Mention the tests in INSTALL.md 2025-01-13 16:42:50 -08:00
Sam Lantinga b6b9390444 Simplified INSTALL.md 2025-01-13 16:42:50 -08:00
Sam Lantinga 55e094f7ac Updated INSTALL.md with simple intro breadcrumbs 2025-01-13 16:42:50 -08:00
Sam Lantinga 584c1d5791 Tweaking the README 2025-01-13 16:42:50 -08:00
Sam Lantinga 995a6a0333 Minor readability improvement for README-contributing.md 2025-01-13 16:42:50 -08:00
Sam Lantinga 86b46c678c Removed README-git.md
We're fully hosted on GitHub, no need for additional explanation.
2025-01-13 16:42:50 -08:00
Sam Lantinga 96414fa56a Removed obsolete Raspberry Pi documentation 2025-01-13 16:42:50 -08:00
Sam Lantinga 670db4d248 Made the README links in INSTALL.md markdown links 2025-01-13 16:42:50 -08:00
Sam Lantinga b08d045811 Added a Discord link to BUGS.txt 2025-01-13 16:42:50 -08:00
Sam Lantinga 2ad0f1e1fe Updated the credits for SDL 3.0 2025-01-13 16:42:50 -08:00
Sam Lantinga 41d48db4ae Removed the runtime README
The main README is suitable for inclusion in redistributable archives and we'll have custom installation instructions for each platform.
2025-01-13 16:42:50 -08:00
Sam Lantinga 922b73195c Simplified the README 2025-01-13 16:42:50 -08:00
Sam Lantinga 5e4a2974aa Removed obsolete warnings about MIT licensed SIMD code
We no longer use the code this was warning about
2025-01-13 16:42:50 -08:00
Ryan C. Gordon 3766a39409 emscripten: double the audio buffer size.
Some systems seem to not keep up with the smaller buffer.

Reference Issue #11930.
2025-01-13 16:26:18 -05:00
SDL Wiki Bot e10e42c814 Sync SDL3 wiki -> header
[ci skip]
2025-01-13 20:58:20 +00:00
Ryan C. Gordon 2b8fb0bdd4 wikiheaders: Maybe fix perl warning.
Reference Issue #11944.
2025-01-13 15:18:39 -05:00
SDL Wiki Bot efaf3739c6 Sync SDL3 wiki -> header
[ci skip]
2025-01-13 19:42:26 +00:00
Ryan C. Gordon 4bddf521dd emscripten: Override emscripten's fullscreen button with SDL's implementation.
Fixes #6798.
Fixes #7913.
Fixes #9044.
2025-01-13 14:17:36 -05:00
expikr 569de84907 better numerical precision for playback example 2025-01-13 10:29:51 -08:00
Sam Lantinga e5a4f09363 Call SDL_UDEV_Quit() if we don't end up using it 2025-01-13 10:22:10 -08:00
SDL Wiki Bot 7d7a76c077 Sync SDL3 wiki -> header
[ci skip]
2025-01-13 17:53:40 +00:00
Sam Lantinga 66408308b8 Added documentation for mouse handling in relative mode
Fixes https://github.com/libsdl-org/SDL/issues/11805
2025-01-13 09:52:21 -08:00
SDL Wiki Bot 438075a83a Sync SDL3 wiki -> header
[ci skip]
2025-01-13 17:38:58 +00:00
Frank Praznik b4562c0243 cocoa: Add a hint to control menu visibility in fullscreen spaces windows
Adds SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY to control whether or not the menu can be accessed when the cursor is moved to the top of the screen when a window is in fullscreen spaces mode.

The three values are true, false, and 'auto' (default), with auto resulting in a hidden menu if fullscreen was toggled programmatically, and the menu being accessible if fullscreen was toggled via the button on the window title bar, so the user has an easy way back out of fullscreen if the client app/game doesn't have a readily available option to toggle it.
2025-01-13 12:37:16 -05:00
Sam Lantinga 611f132fd0 Don't use a hint callback for SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY
This was originally intended to make sure that nativeAllowRecreateActivity() could be called from another thread safely, but the hint system is now thread-safe, so we don't need to use a callback here.

Fixes https://github.com/libsdl-org/SDL/issues/11938
2025-01-13 07:49:09 -08:00
mausimus 03a3c19c27 examples: use doubles to generate sine waves and avoid distortion 2025-01-13 09:50:45 -05:00
Ryan C. Gordon 307e6f2ca6 emscripten: simulate mouse autocapture.
This is just enough to delay MOUSE_LEAVE events until a drag ending outside
the canvas is released, and make sure the MOUSE_UP event has the canvas's
SDL_WindowID, which it wouldn't when mouse focus is was lost by this point.

Fixes #10033.
2025-01-13 02:39:39 -05:00
Anonymous Maarten f79083d9bb release: don't add test directory to mingw release archives 2025-01-13 04:32:49 +01:00
Anonymous Maarten 4ba4f0a106 release: add Android aar to devel zip archive
[ci skip]
2025-01-12 16:28:00 -08:00
Sam Lantinga c4f2f7b352 Removed redundant information in example pages
This is large text and is already covered by the header and breadcrumb
2025-01-12 15:57:48 -08:00
SDL Wiki Bot 949ec0c501 Sync SDL3 wiki -> header
[ci skip]
2025-01-12 23:52:58 +00:00
SDL Wiki Bot 839227b4b0 Sync SDL3 wiki -> header
[ci skip]
2025-01-12 22:24:11 +00:00
cosmonaut c04b739df6 GPU: Note that resource naming functions are not thread safe. 2025-01-12 14:22:26 -08:00
Ethan Lee 3df0767e34 gpu: Initialize Metal stencil format even if stencil test is disabled 2025-01-12 13:05:27 -08:00
Ozkan Sezer 307dac97ac testcontroller.c: fix build errors due to -Wformat after commit b524af1 2025-01-12 22:00:02 +03:00
Sam Lantinga 21cc1878f1 Reset enhanced mode state when closing a controller
Fixes https://github.com/libsdl-org/SDL/issues/11912
2025-01-12 10:45:54 -08:00
Sam Lantinga b524af1b43 testcontroller: log the ID of gamepads as they are added and removed 2025-01-12 10:02:39 -08:00
expikr 9a83fa026d apply multiplier scale after system scale 2025-01-12 08:24:41 -08:00
SDL Wiki Bot ea859fba3a Sync SDL3 wiki -> header
[ci skip]
2025-01-12 16:07:12 +00:00
Sam Lantinga 551510c0eb SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE can be combined with SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE 2025-01-12 08:05:51 -08:00
Ryan C. Gordon 95c1584386 README-migration: note SDL2 brightness/gamma ramp APIs that have been removed.
Fixes #11918.
2025-01-12 04:35:56 -05:00
Ryan C. Gordon f0af6c348a emscripten: Add SDL_EVENT_DISPLAY_ORIENTATION support.
Reference Issue #11389.
2025-01-12 02:23:00 -05:00
Ryan C. Gordon 3ad9c38a46 emscripten: Don't set OpenGL swap intervals until first PumpEvents.
Any requested swap interval will be saved and set on the first PumpEvents.
Once PumpEvents has been called at least once, swap intervals are set
immediately.

This assumes that events won't be pumped until after an Emscripten main loop
has been defined, and so prevents a warning on the javascript console:

"emscripten_set_main_loop_timing: Cannot set timing mode for main loop since
a main loop does not exist! Call emscripten_set_main_loop first to set one
up."

Fixes #9969.
2025-01-11 15:19:09 -05:00
Anonymous Maarten d42b4ed961 Leave SDL_TriggerBreakpoint undefined on unknown platforms 2025-01-11 17:29:27 +01:00
Anthony 9a7cfbc2d0 Add onNativePen to proguard-rules.pro 2025-01-11 07:44:55 -08:00
Ryan C. Gordon 82125ec1d8 x11: Be more aggressive about finding _any_ usable messagebox font.
Fixes #4800.
Fixes #11910.
2025-01-11 00:35:39 -05:00
Sam Lantinga 4231848791 Revert "Separate android initialization from Activity (#11891)"
This reverts commit d14c93c4b1.

This is a major breaking change for activities that inherit SDLActivity
2025-01-10 15:27:08 -08:00
Ozkan Sezer 61f13b94d1 add a fallback SDL_TriggerBreakpoint() for MSVC after commit ebaa30d3. 2025-01-11 02:11:50 +03:00
Xander d14c93c4b1 Separate android initialization from Activity (#11891) 2025-01-10 15:05:58 -08:00
SDL Wiki Bot c64197be1a Sync SDL3 wiki -> header
[ci skip]
2025-01-10 20:56:33 +00:00
Sam Lantinga 042898995c Added SDL_ClickTrayEntry()
Also removed the app delegate from the tray code on Cocoa and folded that into SDL3AppDelegate.

Fixes https://github.com/libsdl-org/SDL/issues/11906
2025-01-10 12:55:50 -08:00
Ryan C. Gordon fb0f6a1196 cocoa: Display mode changes set Desktop display mode, not current. 2025-01-10 15:35:43 -05:00
Ryan C. Gordon 38176bfe9a cocoa: Implemented display hotplugging support.
Fixes #7764.
2025-01-10 13:25:34 -05:00
Frank Praznik 0e2ca934b5 events: Remove unused function declaration 2025-01-10 11:23:54 -05:00
Sam Lantinga 715897aea7 Added support for displaying XIM composition strings
Fixes https://github.com/libsdl-org/SDL/issues/6437
2025-01-10 03:26:42 -08:00
Sam Lantinga a8a65b6fca Use XIM for IME input on X11
Tested with fcitx5 and ibus on Xorg and Xwayland
* Used US English with dead keys and verified that ` followed by a results in à
* Used Hangul to enter Korean and got text in the expected order
* Used the mozc IM to enter Japanese and was able to generate candidates and so forth

Fixes https://github.com/libsdl-org/SDL/issues/3907
Fixes https://github.com/libsdl-org/SDL/issues/6164
Fixes https://github.com/libsdl-org/SDL/issues/11894
2025-01-10 03:26:42 -08:00
SDL Wiki Bot 1f3b40797d Sync SDL3 wiki -> header
[ci skip]
2025-01-10 06:39:06 +00:00
Ryan C. Gordon fb94a79f89 stdinc: define SDL_NOLONGLONG for old Visual Studios, document the symbol.
Reference PR #11900.
2025-01-10 01:37:25 -05:00
Anonymous Maarten bda90c3cb6 cmake: rename SDL_DISABLE_* CMake options to SDL_xxx 2025-01-10 04:23:32 +01:00
Ethan Lee 90aff306c1 gpu: Show a debug error when pipelines are not given the right shader stages 2025-01-09 20:17:21 -05:00
SDL Wiki Bot 00b23a012c Sync SDL3 wiki -> header
[ci skip]
2025-01-09 22:27:31 +00:00
Frank Praznik 6b776a9989 keyboard: Add some SDL keycodes for common Xkb keys
Add SDL keycodes for keys found commonly found in the default Xkb layout, such as left tab and compose, and keys frequently used for custom modifiers such as Meta, Hyper, and Level5 Shift.

As these keys aren't Unicode code points and don't have associated scancodes (at least on modern keyboards), they are placed in the new extended key code space, with bit 30 set as a flag.
2025-01-09 17:26:41 -05:00
Frank Praznik e5966bbdb1 x11: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.

Also use the system modifier state instead of setting them based on key presses, which may be incorrect due to remapping, or toggled in some other manner.
2025-01-09 17:26:41 -05:00
Frank Praznik 73ee99978d wayland: Add support for Mod3 and more esoteric Xkb configurations
Adds support for Mod3, which is usually Level 5 shift, but can vary, as well as not altering the functionality of the more esoteric modifier keys, such as meta and hyper.
2025-01-09 17:26:41 -05:00
Anonymous Maarten ebaa30d339 __debugbreak was introduced in Microsoft Visual Studio 2003 2025-01-09 16:04:14 -05:00
Anonymous Maarten c8f3f1b461 _BitScanReverse was introduced in Microsoft Visual Studio 2005 2025-01-09 16:04:14 -05:00
Anonymous Maarten a78104a47f Disable long long support in the headers with SDL_NOLONGLONG
Some older toolchains don't support 'long long'.
2025-01-09 16:04:14 -05:00
Ethan Lee 6cdde10edb gpu: Metal depth write should behave like Vulkan/D3D12 2025-01-09 15:28:26 -05:00
SDL Wiki Bot dd0dc64d51 Sync SDL3 wiki -> header
[ci skip]
2025-01-09 20:15:17 +00:00
SDL Wiki Bot c688853a82 Sync SDL3 wiki -> header
[ci skip]
2025-01-09 19:47:47 +00:00
Ryan C. Gordon 507593f485 wikiheaders: Allow symbols to be filtered from manpage generation by regex.
This is specifically to prevent generating a manpage for "Uint32" and friends.

Fixes #11898.
2025-01-09 14:13:00 -05:00
Ethan Lee 7acf78ba92 storage: Trim the title storage root from enumerated paths 2025-01-09 13:50:52 -05:00
Frank Praznik 037cd25a22 win32: Use the pending size during NCCALCSIZE
Non-resizable windows still need to apply the pending size, as they can be resized programmatically.

Fixes programmatically resizing windows without the WS_THICKFRAME style.
2025-01-09 12:27:05 -05:00
Cameron Cawley e8916b2608 pipewire: Use byte order pixel format aliases 2025-01-09 09:52:30 -05:00
SDL Wiki Bot d2090d1c80 Sync SDL3 wiki -> header
[ci skip]
2025-01-09 06:38:16 +00:00
Ryan C. Gordon 3f7f632e14 audio: Added SDL_AudioDeviceStreamPaused.
We had the other two wrapper functions to pause and resume, and forgot query.
2025-01-09 01:36:57 -05:00
Ryan C. Gordon f61860fa93 testautomation: fixed incorrect test.
The test was doing this:

- The output size is 80x60
- The logical size is 40x30
- The viewport is { 10, 7, 40, 30 }
- Draw to fill this whole viewport.

This would offset the filled rectangle a little, as before, but then the
viewport was the size of the entire logical space, so it wasn't a rectangle
centered in the middle of the output, as was expected.

This used to produce the expected output before the fix in
fa7a529912. But it appears the test was
incorrect, so this tweaks the viewport to produce the expected result.
2025-01-08 23:33:39 -05:00
Ryan C. Gordon 4bb3c2a1c7 render: Some cleanups.
Mostly setting NULL pointers to a local struct instead of copying non-NULL
pointers' contents into the local struct.
2025-01-08 14:59:28 -05:00
Ryan C. Gordon 61bdbacdae render: SDL_RenderTextureTiled shouldn't try to drop draw calls, either. 2025-01-08 14:59:28 -05:00
Ryan C. Gordon f044a3d6ca Revert "render: GetRenderViewportSize shouldn't use scale, just logical presentation."
This reverts commit ef758d05c1.

Turns out the bug in #11076 was that we were dropping texture draws
incorrectly, not that scale shouldn't be applied here. The dropped draw calls
were fixed in bf85320947, and this revert is
making the renderer consistent again.
2025-01-08 14:59:27 -05:00
Ryan C. Gordon fa7a529912 render: GetRenderViewportSize shouldn't scale viewport dimensions.
These are already scaled for the logical presentation (unless using the pixel
dimensions instead; we still scale those here).

Fixes #11704.
2025-01-08 14:59:27 -05:00
SDL Wiki Bot 1636009511 Sync SDL3 wiki -> header
[ci skip]
2025-01-08 19:57:05 +00:00
Ryan C. Gordon bf85320947 render: Don't try to drop draws outside of the viewport.
It didn't take scale into account, and the backends would need to do clipping
anyhow, so let the system figure that out for us at the lower level.

Fixes #11318.
2025-01-08 11:55:10 -05:00
Frank Praznik f2f04e825d tests: Fix get/set window size test being skipped
A return check conversion was missed when the SDL_* functions were converted to return boolean values instead of int, which caused this test to be skipped.
2025-01-08 11:02:45 -05:00
SDL Wiki Bot cbdbd66e18 Sync SDL3 wiki -> header
[ci skip]
2025-01-08 15:33:53 +00:00
Simon McVittie ef1fdf11bd tray: Create tray icons for libappindicator securely
If we write directly to filenames in /tmp, we're subject to
time-of-check/time-of-use symlink attacks on most systems (although
recent Linux kernels mitigate these by default). We can avoid these
attacks by securely creating a directory owned by our own uid,
and doing all our file I/O in that directory. Other uids cannot create
symbolic links in that directory, so we are protected from symlink
attacks.

This does not protect us from an attacker that is running with the same
uid, but if such an attacker exists, then we have already lost.

Resolves: https://github.com/libsdl-org/SDL/issues/11887
Signed-off-by: Simon McVittie <smcv@collabora.com>
2025-01-08 07:26:02 -08:00
Sam Lantinga e6bb50a710 Updated to version 3.1.9 for development 2025-01-07 17:51:00 -08:00
SDL Wiki Bot 6b34c9fe7f Sync SDL3 wiki -> header
[ci skip]
2025-01-08 01:50:36 +00:00
202 changed files with 4061 additions and 2681 deletions

No files matched your search

+4 -4
View File
@@ -469,7 +469,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cmake_arguments.extend([
"-DCMAKE_SYSTEM_NAME=iOS",
"-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
])
case SdlPlatform.Tvos:
if spec.xcode:
@@ -477,7 +477,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.cmake_arguments.extend([
"-DCMAKE_SYSTEM_NAME=tvOS",
"-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
])
case SdlPlatform.MacOS:
if spec.apple_framework:
@@ -486,7 +486,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.test_pkg_config = False
job.cmake_arguments.extend((
"'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
"-DSDL_FRAMEWORK=ON",
))
job.shared_lib = SharedLibType.FRAMEWORK
@@ -494,7 +494,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.clang_tidy = True
job.cmake_arguments.extend((
"-DCMAKE_OSX_ARCHITECTURES=arm64",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11",
"-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
"-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy",
))
job.shared_lib = SharedLibType.DYLIB
+4 -4
View File
@@ -170,9 +170,9 @@ jobs:
-DSDLTEST_TRACKMEM=ON \
-DSDL_INSTALL_TESTS=${{ matrix.platform.build-tests }} \
-DSDL_CLANG_TIDY=${{ matrix.platform.clang-tidy }} \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
-DSDL_DISABLE_INSTALL_CPACK=OFF \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
-DSDL_INSTALL_DOCS=ON \
-DSDL_INSTALL_CPACK=ON \
-DSDL_INSTALL_DOCS=ON \
${{ matrix.platform.cmake-arguments }} \
-DSDL_SHARED=${{ matrix.platform.shared }} \
-DSDL_STATIC=${{ matrix.platform.static }} \
@@ -293,7 +293,7 @@ jobs:
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-Wdeprecated -Wdev -Werror \
-DSDL_WERROR=${{ matrix.platform.werror }} \
-DSDL_DISABLE_INSTALL_DOCS=OFF \
-DSDL_INSTALL_DOCS=ON \
${{ matrix.platform.cmake-arguments }} \
-DSDL_SHARED=${{ matrix.platform.shared }} \
-DSDL_STATIC=${{ matrix.platform.static }} \
+27 -8
View File
@@ -47,6 +47,14 @@ jobs:
with:
name: sources
path: '${{ github.workspace}}/dist'
- name: 'Generate summary'
run: |
echo "Run the following commands to download all artifacts:" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "mkdir -p /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "cd /tmp/${{ steps.releaser.outputs.project }}-${{ steps.releaser.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "gh run -R ${{ github.repository }} download ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
linux-verify:
needs: [src]
@@ -77,6 +85,14 @@ jobs:
shell: bash
run: |
${{ steps.tar.outputs.path }}/build-scripts/test-versioning.sh
- name: 'Install Linux dependencies'
run: |
sudo apt-get update -y
sudo apt-get install -y \
gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libjack-dev libsndio-dev \
libusb-1.0-0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \
libxss-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
- name: 'CMake (configure + build + tests + examples)'
run: |
cmake -S ${{ steps.tar.outputs.path }} -B /tmp/build -DSDL_TEST_LIBRARY=TRUE -DSDL_TESTS=TRUE -DSDL_EXAMPLES=TRUE
@@ -163,7 +179,7 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \
-Werror=dev \
-B build_darwin
cmake --build build_darwin --config Release --verbose
@@ -175,7 +191,7 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64" \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \
-Werror=dev \
-B build_darwin_2
cmake --build build_darwin --config Release --verbose
@@ -188,7 +204,7 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_ios
cmake --build build_ios --config Release --verbose
@@ -201,7 +217,7 @@ jobs:
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_tvos
cmake --build build_tvos --config Release --verbose
@@ -217,7 +233,7 @@ jobs:
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_ios_simulator
cmake --build build_ios_simulator --config Release --verbose
@@ -233,7 +249,7 @@ jobs:
-DCMAKE_SYSTEM_NAME=tvOS \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DCMAKE_OSX_SYSROOT="${sysroot}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-Werror=dev \
-B build_tvos_simulator
cmake --build build_tvos_simulator --config Release --verbose
@@ -586,8 +602,11 @@ jobs:
- name: 'Extract Android SDK from AAR'
id: sdk
run: |
python "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" -o /tmp/SDL3-android
cd /tmp
unzip "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}"
python "${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" -o /tmp/SDL3-android
echo "prefix=/tmp/SDL3-android" >>$GITHUB_OUTPUT
echo "sdl3-aar=/tmp/${{ needs.src.outputs.project }}-${{ needs.src.outputs.version }}.aar" >>$GITHUB_OUTPUT
- name: 'CMake (configure + build) x86, x64, arm32, arm64'
run: |
android_abis="x86 x86_64 armeabi-v7a arm64-v8a"
@@ -617,7 +636,7 @@ jobs:
echo "path=/tmp/projects/org.libsdl.testspriteminimal" >>$GITHUB_OUTPUT
- name: 'Copy SDL3 aar into Gradle project'
run: |
cp "${{ github.workspace }}/${{ needs.android.outputs.android-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
cp "${{ steps.sdk.outputs.sdl3-aar }}" "${{ steps.create-gradle-project.outputs.path }}/app/libs"
echo ""
echo "Project contents:"
+2
View File
@@ -16,7 +16,9 @@ bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0
wikipreamble = (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!)
wikiheaderfiletext = Defined in [<SDL3/%fname%>](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/%fname%)
manpageheaderfiletext = Defined in SDL3/%fname%
manpagesymbolfilterregex = \A[US]int\d+\Z
# All SDL_test_* headers become undefined categories, everything else just converts like SDL_audio.h -> Audio
# A handful of others we fix up in the header itself with /* WIKI CATEGORY: x */ comments.
+2 -2
View File
@@ -35,8 +35,8 @@ LOCAL_SRC_FILES := \
$(LOCAL_PATH)/src/dialog/android/SDL_androiddialog.c \
$(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/io/*.c) \
$(wildcard $(LOCAL_PATH)/src/io/generic/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/*.c) \
$(wildcard $(LOCAL_PATH)/src/gpu/vulkan/*.c) \
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
+5 -2
View File
@@ -11,6 +11,9 @@ You may also find help at the SDL forums/mailing list:
https://discourse.libsdl.org/
Bug reports are welcome here, but we really appreciate if you use the issue
tracker, as bugs discussed on the mailing list may be forgotten or missed.
or on Discord:
https://discord.com/invite/BwpFGBWsv8
Bug reports are welcome here, but we really appreciate if you use the issue tracker, as bugs discussed on the mailing list or Discord may be forgotten or missed.
+29 -35
View File
@@ -5,16 +5,16 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
endif()
# See docs/release_checklist.md
project(SDL3 LANGUAGES C VERSION "3.1.8")
project(SDL3 LANGUAGES C VERSION "3.1.10")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL3_SUBPROJECT OFF)
set(SDL3_MAINPROJECT ON)
else()
set(SDL3_SUBPROJECT ON)
set(SDL3_MAINPROJECT OFF)
endif()
# By default, configure SDL3 in RelWithDebInfo configuration
if(NOT SDL3_SUBPROJECT)
if(SDL3_MAINPROJECT)
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi_config)
# The first item in CMAKE_CONFIGURATION_TYPES is the default configuration
@@ -287,14 +287,14 @@ if(SOLARIS)
endif()
# Allow some projects to be built conditionally.
set_option(SDL_DISABLE_INSTALL "Disable installation of SDL3" ${SDL3_SUBPROJECT})
cmake_dependent_option(SDL_DISABLE_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_SUBPROJECT} "NOT SDL_DISABLE_INSTALL" ON)
cmake_dependent_option(SDL_DISABLE_INSTALL_DOCS "Install docs for SDL3" ON "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" ON)
set_option(SDL_DISABLE_UNINSTALL "Disable uninstallation of SDL3" OFF)
set_option(SDL_INSTALL "Enable installation of SDL3" ${SDL3_MAINPROJECT})
cmake_dependent_option(SDL_INSTALL_CPACK "Create binary SDL3 archive using CPack" ${SDL3_MAINPROJECT} "SDL_INSTALL" ON)
cmake_dependent_option(SDL_INSTALL_DOCS "Install docs for SDL3" OFF "SDL_INSTALL;NOT SDL_FRAMEWORK" ON)
set_option(SDL_UNINSTALL "Enable uninstallation of SDL3" ${SDL3_MAINPROJECT})
cmake_dependent_option(SDL_PRESEED "Preseed CMake cache to speed up configuration" ON "${SDL_PRESEED_AVAILABLE}" OFF)
cmake_dependent_option(SDL_RELOCATABLE "Create relocatable SDL package" ${SDL_RELOCATABLE_DEFAULT} "NOT SDL_DISABLE_INSTALL" OFF)
cmake_dependent_option(SDL_RELOCATABLE "Create relocatable SDL package" ${SDL_RELOCATABLE_DEFAULT} "SDL_INSTALL" OFF)
cmake_dependent_option(SDL_DISABLE_ANDROID_JAR "Disable creation of SDL3.jar" ${SDL3_SUBPROJECT} "ANDROID" ON)
cmake_dependent_option(SDL_ANDROID_JAR "Enable creation of SDL3.jar" ${SDL3_MAINPROJECT} "ANDROID" ON)
option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
set_option(SDL_ASSEMBLY "Enable assembly routines" ${SDL_ASSEMBLY_DEFAULT})
@@ -308,7 +308,6 @@ dep_option(SDL_SSE4_1 "Use SSE4.1 assembly routines" ON "SDL_ASSEMB
dep_option(SDL_SSE4_2 "Use SSE4.2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_POWERPC32 OR SDL_CPU_POWERPC64" OFF)
dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF)
dep_option(SDL_ARMNEON "Use NEON assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_ARM32 OR SDL_CPU_ARM64" OFF)
dep_option(SDL_LSX "Use LSX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF)
dep_option(SDL_LASX "Use LASX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF)
@@ -394,7 +393,7 @@ cmake_dependent_option(SDL_STATIC "Build a static version of the library" ${SDL_
option(SDL_TEST_LIBRARY "Build the SDL3_test library" ON)
dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST_LIBRARY OFF)
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF)
dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "SDL_INSTALL;NOT SDL_FRAMEWORK" OFF)
dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}")
set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines")
@@ -1159,8 +1158,8 @@ sdl_glob_sources(
"${SDL3_SOURCE_DIR}/src/cpuinfo/*.c"
"${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/io/*.c"
"${SDL3_SOURCE_DIR}/src/io/generic/*.c"
"${SDL3_SOURCE_DIR}/src/filesystem/*.c"
"${SDL3_SOURCE_DIR}/src/gpu/*.c"
"${SDL3_SOURCE_DIR}/src/joystick/*.c"
@@ -1419,7 +1418,7 @@ if(ANDROID)
set(HAVE_CLOCK_GETTIME 1)
endif()
if(NOT SDL_DISABLE_ANDROID_JAR)
if(SDL_ANDROID_JAR)
find_package(Java)
find_package(SdlAndroidPlatform MODULE)
@@ -1449,7 +1448,7 @@ if(ANDROID)
DEPENDS ${SDL_JAVA_SOURCES}
)
add_custom_target(SDL3-javasources ALL DEPENDS "${javasourcesjar}")
if(NOT SDL_DISABLE_INSTALL_DOCS)
if(SDL_INSTALL_DOCS)
set(javadocdir "${SDL3_BINARY_DIR}/docs/javadoc")
set(javadocjar "${SDL3_BINARY_DIR}/SDL3-${SDL3_VERSION}-javadoc.jar")
set(javadoc_index_html "${javadocdir}/index.html")
@@ -1775,7 +1774,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
endif()
if(HAVE_LIBURING_H)
sdl_sources("${SDL3_SOURCE_DIR}/src/file/io_uring/SDL_asyncio_liburing.c")
sdl_sources("${SDL3_SOURCE_DIR}/src/io/io_uring/SDL_asyncio_liburing.c")
endif()
# Always compiled for Linux, unconditionally:
@@ -1890,6 +1889,7 @@ elseif(WINDOWS)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c")
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c")
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/windows/*.c")
if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries.
@@ -2398,6 +2398,7 @@ elseif(APPLE)
endif()
if(SDL_FRAMEWORK_COCOA)
sdl_link_dependency(cocoa LIBS "$<LINK_LIBRARY:FRAMEWORK,Cocoa>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Cocoa")
# macOS 11.0+ iOS 14.0+ tvOS 14.0+
sdl_link_dependency(uniformtypeidentifiers LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,UniformTypeIdentifiers>" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,UniformTypeIdentifiers")
endif()
if(SDL_FRAMEWORK_IOKIT)
@@ -2433,25 +2434,17 @@ elseif(APPLE)
if(SDL_FRAMEWORK_GAMECONTROLLER)
find_library(GAMECONTROLLER GameController)
if(GAMECONTROLLER)
sdl_link_dependency(game_controller LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,GameController>" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,GameController")
sdl_link_dependency(game_controller LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,GameController>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,GameController")
endif()
endif()
if(SDL_FRAMEWORK_METAL)
if(IOS OR TVOS OR VISIONOS OR WATCHOS)
sdl_link_dependency(metal LIBS "$<LINK_LIBRARY:FRAMEWORK,Metal>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Metal")
else()
sdl_link_dependency(metal LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,Metal>" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,Metal")
endif()
sdl_link_dependency(metal LIBS "$<LINK_LIBRARY:FRAMEWORK,Metal>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,Metal")
endif()
if(SDL_FRAMEWORK_OPENGLES)
sdl_link_dependency(opengles LIBS "$<LINK_LIBRARY:FRAMEWORK,OpenGLES>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,OpenGLES")
endif()
if(SDL_FRAMEWORK_QUARTZCORE)
if(IOS OR TVOS OR VISIONOS OR WATCHOS)
sdl_link_dependency(quartz_core LIBS "$<LINK_LIBRARY:FRAMEWORK,QuartzCore>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,QuartzCore")
else()
sdl_link_dependency(metal LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,QuartzCore>" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,QuartzCore")
endif()
sdl_link_dependency(quartz_core LIBS "$<LINK_LIBRARY:FRAMEWORK,QuartzCore>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,QuartzCore")
endif()
if(SDL_FRAMEWORK_UIKIT)
sdl_link_dependency(ui_kit LIBS "$<LINK_LIBRARY:FRAMEWORK,UIKit>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,UIKit")
@@ -2459,7 +2452,8 @@ elseif(APPLE)
if(SDL_FRAMEWORK_COREHAPTICS)
find_library(COREHAPTICS CoreHaptics)
if(COREHAPTICS)
sdl_link_dependency(core_haptics LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreHaptics>" PKG_CONFIG_LINK_OPTIONS "-Wl,-framework,CoreHaptics")
# macOS 10.15+ iOS 13.0+ tvOS 14.0+
sdl_link_dependency(core_haptics LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreHaptics>" PKG_CONFIG_LINK_OPTIONS "-Wl,-weak_framework,CoreHaptics")
endif()
endif()
@@ -2919,7 +2913,7 @@ elseif(N3DS)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/n3ds/*.c")
set(HAVE_SDL_LOCALE TRUE)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/file/n3ds/*.c")
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/n3ds/*.c")
endif()
sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/SDL_dialog.c)
@@ -3337,8 +3331,8 @@ endif()
set_source_files_properties(src/dynapi/SDL_dynapi.c PROPERTIES SKIP_PRECOMPILE_HEADERS 1)
set(SDL_FRAMEWORK_RESOURCES
Xcode/SDL/pkg-support/resources/ReadMe.txt
LICENSE.txt
README.md
)
if(SDL_FRAMEWORK)
sdl_sources(${SDL_FRAMEWORK_RESOURCES})
@@ -3609,7 +3603,7 @@ if(sdl_cmake_modules)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${sdl_cmake_modules} "${SDL3_BINARY_DIR}")
endif()
if(NOT SDL_DISABLE_INSTALL)
if(SDL_INSTALL)
##### sdl3.pc #####
configure_sdl3_pc()
@@ -3709,7 +3703,7 @@ if(NOT SDL_DISABLE_INSTALL)
install(FILES "LICENSE.txt" DESTINATION "${SDL_INSTALL_LICENSEDIR}")
endif()
if(NOT SDL_DISABLE_INSTALL_CPACK)
if(SDL_INSTALL_CPACK)
if(SDL_FRAMEWORK)
set(CPACK_GENERATOR "DragNDrop")
elseif(MSVC)
@@ -3750,7 +3744,7 @@ if(NOT SDL_DISABLE_INSTALL)
endif()
endif()
if(NOT SDL_DISABLE_INSTALL_DOCS)
if(SDL_INSTALL_DOCS)
SDL_generate_manpages(
HEADERS_DIR "${PROJECT_SOURCE_DIR}/include/SDL3"
SYMBOL "SDL_Init"
@@ -3767,7 +3761,7 @@ endif()
##### Uninstall target #####
if(NOT SDL_DISABLE_UNINSTALL)
if(SDL_UNINSTALL)
if(NOT TARGET uninstall)
configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY)
+5 -1
View File
@@ -4,6 +4,10 @@ Thanks to everyone who made this possible, including:
- Cliff Matthews, for giving me a reason to start this project. :) -- Executor rocks! *grin*
- Ryan Gordon for helping everybody out and keeping the dream alive. :)
- Frank Praznik for his Wayland support and general windowing development.
- Ozkan Sezer for sanity checks and make sure the i's are dotted and t's are crossed.
- Anonymous Maarten for CMake support and build system development.
- Evan Hemsley, Caleb Cornett, and Ethan Lee for SDL GPU development.
- Gabriel Jacobo for his work on the Android port and generally helping out all around.
- Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches.
- Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code.
@@ -24,7 +28,7 @@ Thanks to everyone who made this possible, including:
- Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the
Google Summer of Code 2008.
- Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation.
- Everybody at Loki Software, Inc. for their great contributions!
- Everybody at Loki Software, Inc. and Valve Corporation for their great contributions!
And a big hand to everyone else who has contributed over the years.
+26 -51
View File
@@ -1,72 +1,47 @@
# To compile and install SDL:
# To build and use SDL:
## Windows with Visual Studio:
SDL supports a number of development environments:
- [CMake](docs/INTRO-cmake.md)
- [Visual Studio on Windows](docs/INTRO-visualstudio.md)
- [Xcode on Apple platforms](docs/INTRO-xcode.md)
- [Android Studio](docs/INTRO-androidstudio.md)
- [Emscripten for web](docs/INTRO-emscripten.md)
Read ./docs/README-visualc.md
SDL is also usable in other environments. The basic steps are to use CMake to build the library and then use the headers and library that you built in your project. You can search online to see if anyone has specific steps for your setup.
## Windows building with mingw-w64 for x86:
# Documentation
Read [README-windows.md](docs/README-windows.md) for more information on building with MinGW64.
An API reference, tutorials, and additional documentation is available at:
Run: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-i686.cmake && cmake --build build && cmake --install build`
## Windows building with mingw-w64 for x64:
Read [README-windows.md](docs/README-windows.md).
Run: `cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=build-scripts/cmake-toolchain-mingw64-x86_64.cmake && cmake --build build && cmake --install build`
## macOS with Xcode:
Read docs/README-macos.md
## macOS from the command line:
Run: `cmake -S . -B build && cmake --build build && cmake --install build`
### macOS for universal architecture:
Run: `cmake -S . -B build -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" && cmake --build build && cmake --install build`
## Linux and other UNIX systems:
Run: `cmake -S . -B build && cmake --build build --parallel $(nproc) && cmake --install build`
## Android:
Read docs/README-android.md
## iOS:
Read docs/README-ios.md
## Using CMake:
Read docs/README-cmake.md
https://wiki.libsdl.org/SDL3
# Example code
Look at the example programs in ./test, and check out the online
documentation at https://wiki.libsdl.org/SDL3/
There are simple example programs in the examples directory, and you can view them online at:
# Discussion
https://examples.libsdl.org/SDL3
More in-depth test programs are available in the tests directory and can be built by adding `-DSDL_TESTS=ON` to the CMake command line when building SDL.
# Discussions
## Discord
You can join the official Discord server at:
https://discord.com/invite/BwpFGBWsv8
## Forums/mailing lists
Join the SDL developer discussions, sign up on
You can join SDL development discussions at:
https://discourse.libsdl.org/
and go to the development forum
https://discourse.libsdl.org/c/sdl-development/6
Once you sign up, you can use the forum through the website, or as a mailing
list from your email client.
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
## Announcement list
Sign up for the announcement list through the web interface:
You can sign up for the low traffic announcement list at:
https://www.libsdl.org/mailing-list.php
-13
View File
@@ -1,13 +0,0 @@
Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
designed to make it easy to write multi-media software, such as games
and emulators.
The Simple DirectMedia Layer library source code is available from:
https://www.libsdl.org/
This library is distributed under the terms of the zlib license:
http://www.zlib.net/zlib_license.html
+8 -8
View File
@@ -1,16 +1,16 @@
# Simple DirectMedia Layer (SDL) Version 3.0
Simple DirectMedia Layer (SDL for short) is a cross-platform library
designed to make it easy to write multi-media software, such as games
and emulators.
You can find the latest release and additional information at:
https://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware. It is used by video playback software, emulators, and popular games
including Valve's award winning catalog and many Humble Bundle games.
Installation instructions and a quick introduction is available in
[INSTALL.md](INSTALL.md)
More extensive documentation is available in the docs directory, starting
with [README.md](docs/README.md). If you are migrating to SDL 3.0 from SDL 2.0,
the changes are extensively documented in [README-migration.md](docs/README-migration.md).
This library is distributed under the terms of the zlib license,
available in [LICENSE.txt](LICENSE.txt).
Enjoy!
+6 -6
View File
@@ -441,8 +441,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\io\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\io\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" />
@@ -529,9 +529,9 @@
<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\file\windows\SDL_asyncio_windows_ioring.c" />
<ClCompile Include="..\..\src\io\generic\SDL_asyncio_generic.c" />
<ClCompile Include="..\..\src\io\SDL_asyncio.c" />
<ClCompile Include="..\..\src\io\windows\SDL_asyncio_windows_ioring.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" />
@@ -673,7 +673,7 @@
<ClCompile Include="..\..\src\events\SDL_quit.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\file\SDL_iostream.c" />
<ClCompile Include="..\..\src\io\SDL_iostream.c" />
<ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Desktop.x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">true</ExcludedFromBuild>
+6 -6
View File
@@ -45,7 +45,7 @@
<ClCompile Include="..\..\src\events\SDL_quit.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\file\SDL_iostream.c" />
<ClCompile Include="..\..\src\io\SDL_iostream.c" />
<ClCompile Include="..\..\src\filesystem\gdk\SDL_sysfilesystem.cpp" />
<ClCompile Include="..\..\src\gpu\SDL_gpu.c" />
<ClCompile Include="..\..\src\gpu\d3d12\SDL_gpu_d3d12.c" />
@@ -204,9 +204,9 @@
<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\file\windows\SDL_asyncio_windows_ioring.c" />
<ClCompile Include="..\..\src\io\generic\SDL_asyncio_generic.c" />
<ClCompile Include="..\..\src\io\SDL_asyncio.c" />
<ClCompile Include="..\..\src\io\windows\SDL_asyncio_windows_ioring.c" />
<ClCompile Include="..\..\src\dialog\dummy\SDL_dummydialog.c" />
<ClCompile Include="..\..\src\dialog\windows\SDL_windowsdialog.c" />
<ClCompile Include="..\..\src\render\gpu\SDL_pipeline_gpu.c" />
@@ -466,8 +466,8 @@
<ClInclude Include="..\..\src\camera\SDL_camera_c.h" />
<ClInclude Include="..\..\src\camera\SDL_syscamera.h" />
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h" />
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h" />
<ClInclude Include="..\..\src\io\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\io\SDL_sysasyncio.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_common.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_internal.h" />
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb_lsx.h" />
+6 -6
View File
@@ -356,8 +356,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\io\SDL_asyncio_c.h" />
<ClInclude Include="..\..\src\io\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" />
@@ -419,12 +419,12 @@
<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\windows\SDL_asyncio_windows_ioring.c" />
<ClCompile Include="..\..\src\io\windows\SDL_asyncio_windows_ioring.c" />
<ClCompile Include="..\..\src\gpu\SDL_gpu.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\io\generic\SDL_asyncio_generic.c" />
<ClCompile Include="..\..\src\io\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" />
@@ -557,7 +557,7 @@
<ClCompile Include="..\..\src\events\SDL_quit.c" />
<ClCompile Include="..\..\src\events\SDL_touch.c" />
<ClCompile Include="..\..\src\events\SDL_windowevents.c" />
<ClCompile Include="..\..\src\file\SDL_iostream.c" />
<ClCompile Include="..\..\src\io\SDL_iostream.c" />
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfilesystem.c" />
<ClCompile Include="..\..\src\haptic\dummy\SDL_syshaptic.c" />
<ClCompile Include="..\..\src\haptic\SDL_haptic.c" />
+15 -15
View File
@@ -25,7 +25,7 @@
<Filter Include="events">
<UniqueIdentifier>{5e27e19f-b3f8-4e2d-b323-b00b2040ec86}</UniqueIdentifier>
</Filter>
<Filter Include="file">
<Filter Include="io">
<UniqueIdentifier>{a3ab9cff-8495-4a5c-8af6-27e43199a712}</UniqueIdentifier>
</Filter>
<Filter Include="filesystem">
@@ -211,10 +211,10 @@
<Filter Include="main\windows">
<UniqueIdentifier>{00009d5ded166cc6c6680ec771a30000}</UniqueIdentifier>
</Filter>
<Filter Include="file\generic">
<Filter Include="io\generic">
<UniqueIdentifier>{00004d6806b6238cae0ed62db5440000}</UniqueIdentifier>
</Filter>
<Filter Include="file\windows">
<Filter Include="io\windows">
<UniqueIdentifier>{000028b2ea36d7190d13777a4dc70000}</UniqueIdentifier>
</Filter>
</ItemGroup>
@@ -447,11 +447,11 @@
<ClInclude Include="..\..\src\filesystem\SDL_sysfilesystem.h">
<Filter>filesystem</Filter>
</ClInclude>
<ClInclude Include="..\..\src\file\SDL_asyncio_c.h">
<Filter>file</Filter>
<ClInclude Include="..\..\src\io\SDL_asyncio_c.h">
<Filter>io</Filter>
</ClInclude>
<ClInclude Include="..\..\src\file\SDL_sysasyncio.h">
<Filter>file</Filter>
<ClInclude Include="..\..\src\io\SDL_sysasyncio.h">
<Filter>io</Filter>
</ClInclude>
<ClInclude Include="..\..\src\main\SDL_main_callbacks.h">
<Filter>main</Filter>
@@ -965,14 +965,14 @@
<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 Include="..\..\src\io\generic\SDL_asyncio_generic.c">
<Filter>io\generic</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\SDL_asyncio.c">
<Filter>file</Filter>
<ClCompile Include="..\..\src\io\SDL_asyncio.c">
<Filter>io</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\windows\SDL_asyncio_windows_ioring.c">
<Filter>file\windows</Filter>
<ClCompile Include="..\..\src\io\windows\SDL_asyncio_windows_ioring.c">
<Filter>io\windows</Filter>
</ClCompile>
<ClCompile Include="..\..\src\main\generic\SDL_sysmain_callbacks.c">
<Filter>main\generic</Filter>
@@ -1085,8 +1085,8 @@
<ClCompile Include="..\..\src\events\SDL_windowevents.c">
<Filter>events</Filter>
</ClCompile>
<ClCompile Include="..\..\src\file\SDL_iostream.c">
<Filter>file</Filter>
<ClCompile Include="..\..\src\io\SDL_iostream.c">
<Filter>io</Filter>
</ClCompile>
<ClCompile Include="..\..\src\filesystem\windows\SDL_sysfilesystem.c">
<Filter>filesystem\windows</Filter>
+3 -22
View File
@@ -2,32 +2,13 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
3.1.0:
3.2.0:
---------------------------------------------------------------------------
This is a preview release of the new SDL 3.0 API.
The ABI hasn't been locked down yet, but it's fairly stable and feedback is welcome!
Check out [migration guide](docs/README-migration.md) for details on API changes since SDL 2.0, and tips on transitioning your code from SDL2 code to SDL3.
There have been too many changes to list them all, but here are some of the highlights:
* The API has been significantly reworked to be easier to use and more consistent
* The 2D rendering API now has support for more advanced colorspaces and HDR rendering
* The 2D rendering API now has a Vulkan backend
* An example of hardware accelerated video playback using ffmpeg has been added in test/testffmpeg.c
* The shaped window API has been replaced with transparent windows
* Time and date functions have been added in SDL_time.h
* Support for webcam video recording has been added in SDL_camera.h
* Support for handling pens and tablets has been added in SDL_pen.h
* Support for file open and save dialogs has been added in SDL_dialog.h
* Cross-platform functions for working with files and directories are available in SDL_filesystem.h
* A cross-platform abstraction for working with user and game data has been added in SDL_storage.h
* Handling of main() has been moved to a header library and an optional callback-based program flow is available
* Support for simple object properties has been added in SDL_properties.h. These properties are available on many SDL objects, and can be used for more advanced functionality.
Please let us know about issues and feedback at: https://github.com/libsdl-org/SDL/issues
https://wiki.libsdl.org/SDL3/NewFeatures
The development team is focused on code, moving towards the final release, and we would love volunteers to help improve the documentation. Please send e-mail to slouken@libsdl.org if you'd like to help out!
Finally, a giant thank you to all the people who have contributed code and feedback to the SDL 3.0 improvements!
Thank you to all the people who have contributed code and feedback to the SDL 3.0 release!
+2 -2
View File
@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.8</string>
<string>3.1.10</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>3.1.8</string>
<string>3.1.10</string>
</dict>
</plist>
+32 -35
View File
@@ -46,21 +46,22 @@
000098E9DAA43EF6FF7F0000 /* SDL_camera.c in Sources */ = {isa = PBXBuildFile; fileRef = 0000035D38C3899C7EFD0000 /* SDL_camera.c */; };
0000A03C0F32C43816F40000 /* SDL_asyncio_windows_ioring.c in Sources */ = {isa = PBXBuildFile; fileRef = 000030DD21496B5C0F210000 /* SDL_asyncio_windows_ioring.c */; };
0000A4DA2F45A31DC4F00000 /* SDL_sysmain_callbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000BB287BA0A0178C1A0000 /* SDL_sysmain_callbacks.m */; };
0000A877C7DB9FA935FC0000 /* SDL_uikitpen.m in Sources */ = {isa = PBXBuildFile; fileRef = 000053D344416737F6050000 /* SDL_uikitpen.m */; };
0000AEB9AE90228CA2D60000 /* SDL_asyncio.c in Sources */ = {isa = PBXBuildFile; fileRef = 00003928A612EC33D42C0000 /* SDL_asyncio.c */; };
0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; };
007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; platformFilters = (macos, ); };
007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; platformFilters = (ios, maccatalyst, macos, ); };
00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; platformFilters = (macos, ); };
00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); };
00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; };
00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; platformFilters = (macos, ); };
1485C3312BBA4AF30063985B /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1485C32F2BBA4A0C0063985B /* UniformTypeIdentifiers.framework */; platformFilters = (maccatalyst, macos, ); settings = {ATTRIBUTES = (Weak, ); }; };
557D0CFA254586CA003913E3 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); };
557D0CFB254586D7003913E3 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDABD23E28B6200529352 /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
557D0CFA254586CA003913E3 /* CoreHaptics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F37DC5F225350EBC0002E6F7 /* CoreHaptics.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Weak, ); }; };
557D0CFB254586D7003913E3 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A75FDABD23E28B6200529352 /* GameController.framework */; settings = {ATTRIBUTES = (Required, ); }; };
5616CA4C252BB2A6005D5928 /* SDL_url.c in Sources */ = {isa = PBXBuildFile; fileRef = 5616CA49252BB2A5005D5928 /* SDL_url.c */; };
5616CA4D252BB2A6005D5928 /* SDL_sysurl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5616CA4A252BB2A6005D5928 /* SDL_sysurl.h */; };
5616CA4E252BB2A6005D5928 /* SDL_sysurl.m in Sources */ = {isa = PBXBuildFile; fileRef = 5616CA4B252BB2A6005D5928 /* SDL_sysurl.m */; };
564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
564624361FF821C20074AC87 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624351FF821B80074AC87 /* QuartzCore.framework */; settings = {ATTRIBUTES = (Required, ); }; };
564624381FF821DA0074AC87 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 564624371FF821CB0074AC87 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; };
566E26CF246274CC00718109 /* SDL_syslocale.m in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CC246274CB00718109 /* SDL_syslocale.m */; };
566E26D8246274CC00718109 /* SDL_locale.c in Sources */ = {isa = PBXBuildFile; fileRef = 566E26CD246274CB00718109 /* SDL_locale.c */; };
566E26E1246274CC00718109 /* SDL_syslocale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26CE246274CC00718109 /* SDL_syslocale.h */; };
@@ -75,11 +76,9 @@
A1626A522617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; };
A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); };
A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; };
A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); };
A75FDB5823E39E6100529352 /* hidapi.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDB5723E39E6100529352 /* hidapi.h */; };
A75FDBB723E4CBC700529352 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 00794D3F09D0C461003FC8A1 /* License.txt */; };
A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = F59C710300D5CB5801000001 /* ReadMe.txt */; };
A75FDBC523EA380300529352 /* SDL_hidapi_rumble.h in Headers */ = {isa = PBXBuildFile; fileRef = A75FDBC323EA380300529352 /* SDL_hidapi_rumble.h */; };
A75FDBCE23EA380300529352 /* SDL_hidapi_rumble.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDBC423EA380300529352 /* SDL_hidapi_rumble.c */; };
A79745702B2E9D39009D224A /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = A797456F2B2E9D39009D224A /* SDL_hidapi_steamdeck.c */; };
@@ -529,9 +528,7 @@
F3FA5A252B59ACE000FEAD97 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */; };
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, ); };
000012E88BE7D71B274A0000 /* SDL_uikitpen.h in Headers */ = {isa = PBXBuildFile; fileRef = 000063D3D80F97ADC7770000 /* SDL_uikitpen.h */; };
0000A877C7DB9FA935FC0000 /* SDL_uikitpen.m in Sources */ = {isa = PBXBuildFile; fileRef = 000053D344416737F6050000 /* SDL_uikitpen.m */; };
FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, ); settings = {ATTRIBUTES = (Required, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -565,9 +562,11 @@
00003260407E1002EAC10000 /* SDL_main_callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_main_callbacks.h; sourceTree = "<group>"; };
00003928A612EC33D42C0000 /* SDL_asyncio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_asyncio.c; sourceTree = "<group>"; };
00003F472C51CE7DF6160000 /* SDL_systime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systime.c; sourceTree = "<group>"; };
000053D344416737F6050000 /* SDL_uikitpen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitpen.m; sourceTree = "<group>"; };
0000585B2CAB450B40540000 /* SDL_sysasyncio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysasyncio.h; sourceTree = "<group>"; };
00005BD74B46358B33A20000 /* SDL_camera_dummy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_camera_dummy.c; sourceTree = "<group>"; };
00005D3EB902478835E20000 /* SDL_syscamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syscamera.h; sourceTree = "<group>"; };
000063D3D80F97ADC7770000 /* SDL_uikitpen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitpen.h; sourceTree = "<group>"; };
0000641A9BAC11AB3FBE0000 /* SDL_time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_time.c; sourceTree = "<group>"; };
000078E1881E857EBB6C0000 /* SDL_hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hashtable.c; sourceTree = "<group>"; };
00008B79BF08CBCEAC460000 /* SDL_camera_coremedia.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_camera_coremedia.m; sourceTree = "<group>"; };
@@ -583,7 +582,6 @@
0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = "<group>"; };
00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = System/Library/Frameworks/ForceFeedback.framework; sourceTree = SDKROOT; };
00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
1485C32F2BBA4A0C0063985B /* UniformTypeIdentifiers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UniformTypeIdentifiers.framework; path = System/Library/Frameworks/UniformTypeIdentifiers.framework; sourceTree = SDKROOT; };
@@ -940,6 +938,9 @@
F36C342F2C0F876500991150 /* SDL_offscreenvulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_offscreenvulkan.h; sourceTree = "<group>"; };
F36C34302C0F876500991150 /* SDL_offscreenvulkan.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_offscreenvulkan.c; sourceTree = "<group>"; };
F36C7AD0294BA009004D61C3 /* SDL_runapp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_runapp.c; sourceTree = "<group>"; };
F373DA172D3889EE002158FA /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = INSTALL.md; sourceTree = "<group>"; };
F373DA182D388A1E002158FA /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.txt; path = ../../../../LICENSE.txt; sourceTree = "<group>"; };
F373DA192D388A1E002158FA /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../../README.md; sourceTree = "<group>"; };
F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
@@ -1090,12 +1091,9 @@
F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_common.h; sourceTree = "<group>"; };
F3FD042C2C9B755700824C4C /* SDL_hidapi_nintendo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_nintendo.h; sourceTree = "<group>"; };
F3FD042D2C9B755700824C4C /* SDL_hidapi_steam_hori.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam_hori.c; sourceTree = "<group>"; };
F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
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; };
000063D3D80F97ADC7770000 /* SDL_uikitpen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_uikitpen.h; path = SDL_uikitpen.h; sourceTree = "<group>"; };
000053D344416737F6050000 /* SDL_uikitpen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_uikitpen.m; path = SDL_uikitpen.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -1333,7 +1331,7 @@
F37E18542BA50EB40098C111 /* dialog */,
A7D8A5D723E2513D00DCD162 /* dynapi */,
A7D8A92923E2514000DCD162 /* events */,
A7D8A7DA23E2513E00DCD162 /* file */,
A7D8A7DA23E2513E00DCD162 /* io */,
A7D8A7F623E2513F00DCD162 /* filesystem */,
E4F257872C81903800FCEAFC /* gpu */,
A7D8A5C223E2513D00DCD162 /* haptic */,
@@ -1920,7 +1918,7 @@
path = darwin;
sourceTree = "<group>";
};
A7D8A7DA23E2513E00DCD162 /* file */ = {
A7D8A7DA23E2513E00DCD162 /* io */ = {
isa = PBXGroup;
children = (
A7D8A7DB23E2513F00DCD162 /* SDL_iostream.c */,
@@ -1930,7 +1928,7 @@
000013C0F2EADC24ADC10000 /* generic */,
000064F9A2AAE947C1CD0000 /* windows */,
);
path = file;
path = io;
sourceTree = "<group>";
};
A7D8A7DF23E2513F00DCD162 /* power */ = {
@@ -2411,8 +2409,9 @@
isa = PBXGroup;
children = (
F37A8E1928405AA100C38E95 /* CMake */,
00794D3F09D0C461003FC8A1 /* License.txt */,
F59C710300D5CB5801000001 /* ReadMe.txt */,
F373DA182D388A1E002158FA /* LICENSE.txt */,
F373DA192D388A1E002158FA /* README.md */,
F373DA172D3889EE002158FA /* INSTALL.md */,
);
path = resources;
sourceTree = "<group>";
@@ -2756,8 +2755,6 @@
buildActionMask = 2147483647;
files = (
F37A8E1A28405AA100C38E95 /* CMake in Resources */,
A75FDBB823E4CBC700529352 /* ReadMe.txt in Resources */,
A75FDBB723E4CBC700529352 /* License.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -2780,7 +2777,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\ncp pkg-support/share/cmake/SDL3/SDL3Config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/share/cmake/SDL3/SDL3ConfigVersion.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
shellScript = "set -ex\n\nmkdir -p build/dmg-tmp/share/cmake/SDL3\ncp -a build/SDL3.xcframework build/dmg-tmp/\n\ncp ../../LICENSE.txt build/dmg-tmp\ncp ../../README.md build/dmg-tmp\ncp pkg-support/resources/INSTALL.md build/dmg-tmp\ncp pkg-support/share/cmake/SDL3/SDL3Config.cmake build/dmg-tmp/share/cmake/SDL3\ncp pkg-support/share/cmake/SDL3/SDL3ConfigVersion.cmake build/dmg-tmp/share/cmake/SDL3\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL3 -srcfolder build/dmg-tmp build/SDL3.dmg\n\n# clean up\nrm -rf build/dmg-tmp\n";
};
F3B38CF0296F63D1005DA6D3 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -3048,8 +3045,8 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 109.0.0;
DYLIB_CURRENT_VERSION = 109.0.0;
DYLIB_COMPATIBILITY_VERSION = 111.0.0;
DYLIB_CURRENT_VERSION = 111.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -3073,7 +3070,7 @@
/usr/X11R6/include,
);
INFOPLIST_FILE = "Info-Framework.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -3083,15 +3080,15 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 3.1.8;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.1.10;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
PRODUCT_NAME = SDL3;
STRIP_STYLE = "non-global";
SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTS_MACCATALYST = YES;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 11.0;
XROS_DEPLOYMENT_TARGET = 1.0;
};
name = Release;
@@ -3112,8 +3109,8 @@
ALLOW_TARGET_PLATFORM_SPECIALIZATION = YES;
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
DYLIB_COMPATIBILITY_VERSION = 109.0.0;
DYLIB_CURRENT_VERSION = 109.0.0;
DYLIB_COMPATIBILITY_VERSION = 111.0.0;
DYLIB_CURRENT_VERSION = 111.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -3134,7 +3131,7 @@
/usr/X11R6/include,
);
INFOPLIST_FILE = "Info-Framework.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -3144,8 +3141,8 @@
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
MARKETING_VERSION = 3.1.8;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 3.1.10;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
@@ -3153,7 +3150,7 @@
STRIP_INSTALLED_PRODUCT = NO;
SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos";
SUPPORTS_MACCATALYST = YES;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 11.0;
XROS_DEPLOYMENT_TARGET = 1.0;
};
name = Debug;
+1 -1
View File
@@ -1,4 +1,4 @@
Title SDL 3.1.8
Title SDL 3.1.10
Version 1
Description SDL Library for macOS (http://www.libsdl.org)
DefaultLocation /Library/Frameworks
@@ -0,0 +1,41 @@
# Using this package
This package contains SDL built for Xcode, and includes support for macOS, iOS and tvOS.
To use this package, drag SDL3.xcframework into your project.
# Documentation
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
# Example code
There are simple example programs available at:
https://examples.libsdl.org/SDL3
# Discussions
## Discord
You can join the official Discord server at:
https://discord.com/invite/BwpFGBWsv8
## Forums/mailing lists
You can join SDL development discussions at:
https://discourse.libsdl.org/
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
## Announcement list
You can sign up for the low traffic announcement list at:
https://www.libsdl.org/mailing-list.php
@@ -1,19 +0,0 @@
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
@@ -1,44 +0,0 @@
The Simple DirectMedia Layer (SDL for short) is a cross-platform
library designed to make it easy to write multi-media software,
such as games and emulators.
The Simple DirectMedia Layer library source code is available from:
http://www.libsdl.org/
This library is distributed under the terms of the zlib license:
http://zlib.net/zlib_license.html
This packages contains the SDL framework for macOS.
Conforming with Apple guidelines, this framework
contains both the SDL runtime component and development header files.
To Install:
Copy "SDL3.xcframework" and "share" to /Library/Frameworks
You may alternatively install it in <Your home directory>/Library/Frameworks
if your access privileges are not high enough.
Use in CMake projects:
SDL3.xcframework can be used in CMake projects using the following pattern:
```cmake
find_package(SDL3 REQUIRED COMPONENTS SDL3)
add_executable(my_game ${MY_SOURCES})
target_link_libraries(my_game PRIVATE SDL3::SDL3)
```
If SDL3.framework is installed in a non-standard location,
please refer to the following link for ways to configure CMake:
https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure
Additional References:
- Screencast tutorials for getting started with OpenSceneGraph/macOS are
available at:
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips
Though these are OpenSceneGraph centric, the same exact concepts apply to
SDL, thus the videos are recommended for everybody getting started with
developing on macOS. (You can skim over the PlugIns stuff since SDL
doesn't have any PlugIns to worry about.)
Binary file not shown.
+1
View File
@@ -36,6 +36,7 @@
int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]);
void minimizeWindow();
boolean openURL(java.lang.String);
void onNativePen(int, int, int , float , float , float);
void requestPermission(java.lang.String, int);
boolean showToast(java.lang.String, int, int, int, int);
boolean sendMessage(int, int);
@@ -60,7 +60,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 3;
private static final int SDL_MINOR_VERSION = 1;
private static final int SDL_MICRO_VERSION = 8;
private static final int SDL_MICRO_VERSION = 10;
/*
// Display InputType.SOURCE/CLASS of events and devices
//
@@ -231,6 +231,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected static boolean mSDLMainFinished = false;
protected static boolean mActivityCreated = false;
private static SDLFileDialogState mFileDialogState = null;
protected static boolean mDispatchingKeyEvent = false;
protected static SDLGenericMotionListener_API14 getMotionListener() {
if (mMotionListener == null) {
@@ -807,7 +808,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
) {
return false;
}
return super.dispatchKeyEvent(event);
mDispatchingKeyEvent = true;
boolean result = super.dispatchKeyEvent(event);
mDispatchingKeyEvent = false;
return result;
}
public static boolean dispatchingKeyEvent() {
return mDispatchingKeyEvent;
}
/* Transition to next state */
@@ -1495,7 +1503,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
// they are ignored here because sending them as mouse input to SDL is messy
if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) {
Log.v("SDL", "keycode is back or forward");
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
case KeyEvent.ACTION_UP:
@@ -1508,6 +1515,8 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
if (event.getAction() == KeyEvent.ACTION_DOWN) {
onNativeKeyDown(keyCode);
if (isTextInputEvent(event)) {
if (ic != null) {
ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
@@ -1515,7 +1524,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
}
}
onNativeKeyDown(keyCode);
return true;
} else if (event.getAction() == KeyEvent.ACTION_UP) {
onNativeKeyUp(keyCode);
@@ -111,18 +111,20 @@ public class SDLInputConnection extends BaseInputConnection
if (matchLength < text.length()) {
String pendingText = text.subSequence(matchLength, text.length()).toString();
for (offset = 0; offset < pendingText.length(); ) {
int codePoint = pendingText.codePointAt(offset);
if (codePoint == '\n') {
if (SDLActivity.onNativeSoftReturnKey()) {
return;
if (!SDLActivity.dispatchingKeyEvent()) {
for (offset = 0; offset < pendingText.length(); ) {
int codePoint = pendingText.codePointAt(offset);
if (codePoint == '\n') {
if (SDLActivity.onNativeSoftReturnKey()) {
return;
}
}
/* Higher code points don't generate simulated scancodes */
if (codePoint > 0 && codePoint < 128) {
nativeGenerateScancodeForUnichar((char)codePoint);
}
offset += Character.charCount(codePoint);
}
/* Higher code points don't generate simulated scancodes */
if (codePoint < 128) {
nativeGenerateScancodeForUnichar((char)codePoint);
}
offset += Character.charCount(codePoint);
}
SDLInputConnection.nativeCommitText(pendingText, 0);
}
+52 -21
View File
@@ -891,6 +891,12 @@ class Releaser:
platform_versions = []
for platform_dir in platform_dirs:
logger.debug("Found Android Platform SDK: %s", platform_dir)
if not (platform_dir / "android.jar").is_file():
logger.debug("Skipping SDK, missing android.jar")
continue
if platform_dir.match('*/android-*-ext*'):
logger.debug("Skipping SDK, extended version")
continue
if m:= re_platform.match(platform_dir.name):
platform_versions.append(int(m.group(1)))
platform_versions.sort()
@@ -961,7 +967,8 @@ class Releaser:
if not cmake_toolchain_file.exists():
logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file)
raise SystemExit(1)
aar_path = self.dist_path / f"{self.project}-{self.version}.aar"
aar_path = self.root / "build-android" / f"{self.project}-{self.version}.aar"
android_dist_path = self.dist_path / f"{self.project}-devel-{self.version}-android.zip"
android_abis = self.release_info["android"]["abis"]
java_jars_added = False
module_data_added = False
@@ -969,14 +976,24 @@ class Releaser:
shutil.rmtree(android_deps_path, ignore_errors=True)
for dep, depinfo in self.release_info["android"].get("dependencies", {}).items():
android_aar = self.deps_path / glob.glob(depinfo["artifact"], root_dir=self.deps_path)[0]
with self.section_printer.group(f"Extracting Android dependency {dep} ({android_aar.name})"):
self.executer.run([sys.executable, str(android_aar), "-o", str(android_deps_path)])
dep_devel_zip = self.deps_path / glob.glob(depinfo["artifact"], root_dir=self.deps_path)[0]
dep_extract_path = self.deps_path / f"extract/android/{dep}"
shutil.rmtree(dep_extract_path, ignore_errors=True)
dep_extract_path.mkdir(parents=True, exist_ok=True)
with self.section_printer.group(f"Extracting Android dependency {dep} ({dep_devel_zip})"):
with zipfile.ZipFile(dep_devel_zip, "r") as zf:
zf.extractall(dep_extract_path)
dep_devel_aar = dep_extract_path / glob.glob("*.aar", root_dir=dep_extract_path)[0]
self.executer.run([sys.executable, str(dep_devel_aar), "-o", str(android_deps_path)])
for module_name, module_info in self.release_info["android"]["modules"].items():
assert "type" in module_info and module_info["type"] in ("interface", "library"), f"module {module_name} must have a valid type"
archive_file_tree = ArchiveFileTree()
aar_file_tree = ArchiveFileTree()
android_devel_file_tree = ArchiveFileTree()
for android_abi in android_abis:
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
@@ -1027,20 +1044,20 @@ class Releaser:
assert library.suffix in (".so", ".a")
assert library.is_file(), f"CMake should have built library '{library}' for module {module_name}"
arcdir_prefab_libs = f"{arcdir_prefab_module}/libs/android.{android_abi}"
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath=f"{arcdir_prefab_libs}/{library.name}", path=library, time=self.arc_time))
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=f"{arcdir_prefab_libs}/abi.json", text=self._get_prefab_abi_json_text(abi=android_abi, cpp=False, shared=library.suffix == ".so"), time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath=f"{arcdir_prefab_libs}/{library.name}", path=library, time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=f"{arcdir_prefab_libs}/abi.json", text=self._get_prefab_abi_json_text(abi=android_abi, cpp=False, shared=library.suffix == ".so"), time=self.arc_time))
if not module_data_added:
library_name = None
if module_info["type"] == "library":
library_name = Path(module_info["library"]).stem.removeprefix("lib")
export_libraries = module_info.get("export-libraries", [])
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_module, "module.json"), text=self._get_prefab_module_json_text(library_name=library_name, export_libraries=export_libraries), time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_module, "module.json"), text=self._get_prefab_module_json_text(library_name=library_name, export_libraries=export_libraries), time=self.arc_time))
arcdir_prefab_include = f"prefab/modules/{module_name}/include"
if "includes" in module_info:
archive_file_tree.add_file_mapping(arc_dir=arcdir_prefab_include, file_mapping=module_info["includes"], file_mapping_root=install_dir, context=self.get_context(), time=self.arc_time)
aar_file_tree.add_file_mapping(arc_dir=arcdir_prefab_include, file_mapping=module_info["includes"], file_mapping_root=install_dir, context=self.get_context(), time=self.arc_time)
else:
archive_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time))
module_data_added = True
if not java_jars_added:
@@ -1053,21 +1070,28 @@ class Releaser:
assert sources_jar_path.is_file(), f"CMake should have archived the java sources into a JAR ({sources_jar_path})"
assert doc_jar_path.is_file(), f"CMake should have archived javadoc into a JAR ({doc_jar_path})"
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes.jar", path=classes_jar_path, time=self.arc_time))
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-sources.jar", path=sources_jar_path, time=self.arc_time))
archive_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-doc.jar", path=doc_jar_path, time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes.jar", path=classes_jar_path, time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-sources.jar", path=sources_jar_path, time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_fs(arcpath="classes-doc.jar", path=doc_jar_path, time=self.arc_time))
assert ("jars" in self.release_info["android"] and java_jars_added) or "jars" not in self.release_info["android"], "Must have archived java JAR archives"
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
aar_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"]["aar-files"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
archive_file_tree.add_file(NodeInArchive.from_text(arcpath="prefab/prefab.json", text=self._get_prefab_json_text(), time=self.arc_time))
archive_file_tree.add_file(NodeInArchive.from_text(arcpath="AndroidManifest.xml", text=self._get_android_manifest_text(), time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_text(arcpath="prefab/prefab.json", text=self._get_prefab_json_text(), time=self.arc_time))
aar_file_tree.add_file(NodeInArchive.from_text(arcpath="AndroidManifest.xml", text=self._get_android_manifest_text(), time=self.arc_time))
with Archiver(zip_path=aar_path) as archiver:
archive_file_tree.add_to_archiver(archive_base="", archiver=archiver)
aar_file_tree.add_to_archiver(archive_base="", archiver=archiver)
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time)
self.artifacts[f"android-aar"] = aar_path
android_devel_file_tree.add_file(NodeInArchive.from_fs(arcpath=aar_path.name, path=aar_path))
android_devel_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["android"]["files"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
with Archiver(zip_path=android_dist_path) as archiver:
android_devel_file_tree.add_to_archiver(archive_base="", archiver=archiver)
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time)
self.artifacts[f"android-aar"] = android_dist_path
def download_dependencies(self):
shutil.rmtree(self.deps_path, ignore_errors=True)
@@ -1104,7 +1128,7 @@ class Releaser:
assert len(msvc_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
if "android" in self.release_info:
android_matches = glob.glob(self.release_info["android"]["dependencies"][dep]["artifact"], root_dir=self.deps_path)
assert len(android_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
assert len(android_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {android_matches}"
@staticmethod
def _arch_to_vs_platform(arch: str, configuration: str="Release") -> VsArchPlatformConfig:
@@ -1230,6 +1254,10 @@ class Releaser:
platform_context = self.get_context(extra_context=arch_platform.extra_context())
build_type = "Release"
extra_context = {
"ARCH": arch_platform.arch,
"PLATFORM": arch_platform.platform,
}
built_paths = set(install_path / configure_text(f, context=platform_context) for file_mapping in (self.release_info["msvc"]["cmake"]["files-lib"], self.release_info["msvc"]["cmake"]["files-devel"]) for files_list in file_mapping.values() for f in files_list)
logger.info("CMake builds these files, to be included in the package: %s", built_paths)
@@ -1280,7 +1308,7 @@ class Releaser:
logger.info("Collecting files...")
archive_file_tree = ArchiveFileTree()
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["cmake"]["files-lib"], file_mapping_root=install_path, context=platform_context, time=self.arc_time)
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
archive_file_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["msvc"]["files-lib"], file_mapping_root=self.root, context=self.get_context(extra_context=extra_context), time=self.arc_time)
logger.info("Creating %s", zip_path)
with Archiver(zip_path=zip_path) as archiver:
@@ -1471,8 +1499,11 @@ def main(argv=None) -> int:
if args.android_api is None:
with section_printer.group("Detect Android APIS"):
args.android_api = releaser._detect_android_api(android_home=args.android_home)
if args.android_api is None or not (Path(args.android_home) / f"platforms/android-{args.android_api}").is_dir():
if args.android_api is None:
parser.error("Invalid --android-api, and/or could not be detected")
android_api_path = Path(args.android_home) / f"platforms/android-{args.android_api}"
if not android_api_path.is_dir():
parser.error(f"Android API directory does not exist ({android_api_path})")
with section_printer.group("Android arguments"):
print(f"android_home = {args.android_home}")
print(f"android_ndk_home = {args.android_ndk_home}")
+40 -10
View File
@@ -1,7 +1,13 @@
This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source.
# Using this package
This package contains SDL built for the Android platform.
## Gradle integration
For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
Copy this archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project.
Copy the aar archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project.
In `app/build.gradle` of your Android project, add:
```
@@ -40,22 +46,46 @@ $(call import-module,prefab/@<@PROJECT_NAME@>@)
---
For advanced users:
## Other build systems (advanced)
If you want to build a 3rd party library outside Gradle,
If you want to build a project without Gradle,
running the following command will extract the Android archive into a more common directory structure.
```
python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix
```
Add `--help` for a list of all available options.
# Documentation
Look at the example programs in ./test (of the source archive), and check out online documentation:
https://wiki.libsdl.org/SDL3/FrontPage
An API reference, tutorials, and additional documentation is available at:
Join the SDL discourse server if you want to join the community:
https://discourse.libsdl.org/
https://wiki.libsdl.org/SDL3
# Example code
There are simple example programs available at:
https://examples.libsdl.org/SDL3
# Discussions
## Discord
You can join the official Discord server at:
https://discord.com/invite/BwpFGBWsv8
## Forums/mailing lists
You can join SDL development discussions at:
https://discourse.libsdl.org/
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
## Announcement list
You can sign up for the low traffic announcement list at:
https://www.libsdl.org/mailing-list.php
That's it!
Sam Lantinga <slouken@libsdl.org>
@@ -0,0 +1,53 @@
# Using this package
This package contains SDL built for the mingw-w64 toolchain.
The files for 32-bit architecture are in i686-w64-mingw32
The files for 64-bit architecture are in x86_64-w64-mingw32
You can install them to another location, just type `make` for help.
To use this package, point your include path at _arch_/include and your library path at _arch_/lib, link with the SDL3 library and copy _arch_/bin/SDL3.dll next to your executable.
e.g.
```sh
gcc -o hello.exe hello.c -Ix86_64-w64-mingw32/include -Lx86_64-w64-mingw32/lib -lSDL3
cp x86_64-w64-mingw32/bin/SDL3.dll .
./hello.exe
```
# Documentation
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
# Example code
There are simple example programs available at:
https://examples.libsdl.org/SDL3
# Discussions
## Discord
You can join the official Discord server at:
https://discord.com/invite/BwpFGBWsv8
## Forums/mailing lists
You can join SDL development discussions at:
https://discourse.libsdl.org/
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
## Announcement list
You can sign up for the low traffic announcement list at:
https://www.libsdl.org/mailing-list.php
@@ -1,25 +0,0 @@
The 32-bit files are in i686-w64-mingw32
The 64-bit files are in x86_64-w64-mingw32
To install SDL for 32-bit x86 executables (i686):
make install-i686
To install SDL for 64-bit x86 executables (x86_64):
make install-x86_64
To install both:
make install-all
Use DESTDIR to change the target location
mkdir $HOME/mingw32-prefix
make install-i686 DESTDIR=$HOME/mingw32-prefix
Look at the example programs in ./test, and check out online documentation:
https://wiki.libsdl.org/SDL3/FrontPage
Join the SDL discourse server if you want to join the community:
https://discourse.libsdl.org/
That's it!
Sam Lantinga <slouken@libsdl.org>
+45
View File
@@ -0,0 +1,45 @@
# Using this package
This package contains SDL built for Visual Studio.
To use this package, edit your project properties:
- Add the include directory to "VC++ Directories" -> "Include Directories"
- Add the lib/_arch_ directory to "VC++ Directories" -> "Library Directories"
- Add SDL3.lib to Linker -> Input -> "Additional Dependencies"
- Copy lib/_arch_/SDL3.dll to your project directory.
# Documentation
An API reference, tutorials, and additional documentation is available at:
https://wiki.libsdl.org/SDL3
# Example code
There are simple example programs available at:
https://examples.libsdl.org/SDL3
# Discussions
## Discord
You can join the official Discord server at:
https://discord.com/invite/BwpFGBWsv8
## Forums/mailing lists
You can join SDL development discussions at:
https://discourse.libsdl.org/
Once you sign up, you can use the forum through the website or as a mailing list from your email client.
## Announcement list
You can sign up for the low traffic announcement list at:
https://www.libsdl.org/mailing-list.php
@@ -0,0 +1,13 @@
# Using this package
This package contains @<@PROJECT_NAME@>@ built for arm64 Windows.
To use this package, simply replace an existing 64-bit ARM @<@PROJECT_NAME@>@.dll with the one included here.
# Development packages
If you're looking for packages with headers and libraries, you can download one of these:
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
@@ -0,0 +1,13 @@
# Using this package
This package contains @<@PROJECT_NAME@>@ built for x64 Windows.
To use this package, simply replace an existing 64-bit @<@PROJECT_NAME@>@.dll with the one included here.
# Development packages
If you're looking for packages with headers and libraries, you can download one of these:
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
@@ -0,0 +1,13 @@
# Using this package
This package contains @<@PROJECT_NAME@>@ built for x86 Windows.
To use this package, simply replace an existing 32-bit @<@PROJECT_NAME@>@.dll with the one included here.
# Development packages
If you're looking for packages with headers and libraries, you can download one of these:
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-VC.zip, for development using Visual Studio
- @<@PROJECT_NAME@>@-devel-@<@PROJECT_VERSION@>@-mingw.zip, for development using mingw-w64
+21 -28
View File
@@ -45,24 +45,14 @@
},
"files": {
"": [
"build-scripts/pkg-support/mingw/INSTALL.txt",
"build-scripts/pkg-support/mingw/INSTALL.md",
"build-scripts/pkg-support/mingw/Makefile",
"BUGS.txt",
"CREDITS.md",
"README-SDL.txt",
"WhatsNew.txt",
"LICENSE.txt",
"README.md"
],
"cmake": [
"build-scripts/pkg-support/mingw/cmake/SDL3Config.cmake",
"build-scripts/pkg-support/mingw/cmake/SDL3ConfigVersion.cmake"
],
"docs": [
"docs/*"
],
"test": [
"test/*"
]
}
},
@@ -120,25 +110,22 @@
},
"files-lib": {
"": [
"README-SDL.txt"
"build-scripts/pkg-support/msvc/@<@ARCH@>@/INSTALL.md.in:INSTALL.md",
"LICENSE.txt",
"README.md"
]
},
"files-devel": {
"": [
"README-SDL.txt",
"BUGS.txt",
"build-scripts/pkg-support/msvc/INSTALL.md",
"LICENSE.txt",
"README.md",
"WhatsNew.txt"
"README.md"
],
"cmake": [
"build-scripts/pkg-support/msvc/cmake/SDL3Config.cmake.in:SDL3Config.cmake",
"build-scripts/pkg-support/msvc/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake",
"cmake/sdlcpu.cmake"
],
"docs": [
"docs/*"
],
"include/SDL3": [
"include/SDL3/*.h"
]
@@ -151,9 +138,9 @@
"-DSDL_STATIC=OFF",
"-DSDL_TEST_LIBRARY=ON",
"-DSDL_TESTS=OFF",
"-DSDL_DISABLE_ANDROID_JAR=OFF",
"-DSDL_DISABLE_INSTALL=OFF",
"-DSDL_DISABLE_INSTALL_DOCS=OFF",
"-DSDL_ANDROID_JAR=ON",
"-DSDL_INSTALL=ON",
"-DSDL_INSTALL_DOCS=ON",
"-DSDL_VENDOR_INFO=libsdl.org"
]
},
@@ -197,20 +184,26 @@
"api-minimum": 19,
"api-target": 29,
"ndk-minimum": 21,
"files": {
"aar-files": {
"": [
"android-project/app/proguard-rules.pro:proguard.txt",
"build-scripts/pkg-support/android/INSTALL.md.in:INSTALL.md",
"build-scripts/pkg-support/android/__main__.py.in:__main__.py",
"build-scripts/pkg-support/android/description.json.in:description.json"
"build-scripts/pkg-support/android/aar/__main__.py.in:__main__.py",
"build-scripts/pkg-support/android/aar/description.json.in:description.json"
],
"META-INF": [
"LICENSE.txt"
],
"cmake": [
"cmake/sdlcpu.cmake",
"build-scripts/pkg-support/android/cmake/SDL3Config.cmake",
"build-scripts/pkg-support/android/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake"
"build-scripts/pkg-support/android/aar/cmake/SDL3Config.cmake",
"build-scripts/pkg-support/android/aar/cmake/SDL3ConfigVersion.cmake.in:SDL3ConfigVersion.cmake"
]
},
"files": {
"": [
"build-scripts/pkg-support/android/INSTALL.md.in:INSTALL.md",
"LICENSE.txt",
"README.md"
]
}
}
+11 -1
View File
@@ -50,6 +50,7 @@ my $optionsfname = undef;
my $wikipreamble = undef;
my $wikiheaderfiletext = 'Defined in %fname%';
my $manpageheaderfiletext = 'Defined in %fname%';
my $manpagesymbolfilterregex = undef;
my $headercategoryeval = undef;
my $quickrefenabled = 0;
my @quickrefcategoryorder;
@@ -127,6 +128,7 @@ if (defined $optionsfname) {
$wikipreamble = $val, next if $key eq 'wikipreamble';
$wikiheaderfiletext = $val, next if $key eq 'wikiheaderfiletext';
$manpageheaderfiletext = $val, next if $key eq 'manpageheaderfiletext';
$manpagesymbolfilterregex = $val, next if $key eq 'manpagesymbolfilterregex';
$headercategoryeval = $val, next if $key eq 'headercategoryeval';
$quickrefenabled = int($val), next if $key eq 'quickrefenabled';
@quickrefcategoryorder = split(/,/, $val), next if $key eq 'quickrefcategoryorder';
@@ -2625,6 +2627,12 @@ if ($copy_direction == 1) { # --copy-to-headers
<!-- END CATEGORY DOCUMENTATION -->
## Categories
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: Category$cat, CategoryAPICategory -->
<!-- END CATEGORY LIST -->
## Functions
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
@@ -2758,6 +2766,7 @@ __EOF__
my $sym = $_;
next if not defined $wikisyms{$sym}; # don't have a page for that function, skip it.
next if $sym =~ /\A\[category documentation\]/; # not real symbols
next if (defined $manpagesymbolfilterregex) && ($sym =~ /$manpagesymbolfilterregex/);
my $symtype = $headersymstype{$sym};
my $wikitype = $wikitypes{$sym};
my $sectionsref = $wikisyms{$sym};
@@ -2789,7 +2798,8 @@ __EOF__
my $decl = $headerdecls{$sym};
my $str = '';
$brief = "$brief";
# the "$brief" makes sure this is a copy of the string, which is doing some weird reference thing otherwise.
$brief = defined $brief ? "$brief" : '';
$brief =~ s/\A[\s\n]*\= .*? \=\s*?\n+//ms;
$brief =~ s/\A[\s\n]*\=\= .*? \=\=\s*?\n+//ms;
$brief =~ s/\A(.*?\.) /$1\n/; # \brief should only be one sentence, delimited by a period+space. Split if necessary.
-18
View File
@@ -376,24 +376,6 @@ function(SDL_PrintSummary)
message(STATUS "")
endif()
if(WARN_ABOUT_ARM_SIMD_ASM_MIT)
message(STATUS "SDL is being built with ARM SIMD optimizations, which")
message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "")
message(STATUS " -DSDL_ARMSIMD=OFF")
message(STATUS "")
endif()
if(WARN_ABOUT_ARM_NEON_ASM_MIT)
message(STATUS "SDL is being built with ARM NEON optimizations, which")
message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "")
message(STATUS " -DSDL_ARMNEON=OFF")
message(STATUS "")
endif()
if(UNIX AND NOT (ANDROID OR APPLE OR EMSCRIPTEN OR HAIKU OR RISCOS))
if(NOT (HAVE_X11 OR HAVE_WAYLAND))
if(NOT SDL_UNIX_CONSOLE_BUILD)
+17
View File
@@ -0,0 +1,17 @@
# Introduction to SDL with Android Studio
We'll start by creating a simple project to build and run [hello.c](hello.c)
- Use our handy script to create a template project:
```sh
./build-scripts/create-android-project.py org.libsdl.hello docs/hello.c
```
- Run Android Studio and open the newly created build/org.libsdl.hello directory
- Build and run!
A more complete example is available at:
https://github.com/Ravbug/sdl3-sample
Additional information and troubleshooting is available in [README-android.md](README-android.md)
+50
View File
@@ -0,0 +1,50 @@
# Introduction to SDL with CMake
The easiest way to use SDL is to include it as a subproject in your project.
We'll start by creating a simple project to build and run [hello.c](hello.c)
Create the file CMakeLists.txt
```cmake
cmake_minimum_required(VERSION 3.16)
project(hello)
# set the output directory for built objects.
# This makes sure that the dynamic library goes into the build directory automatically.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIGURATION>")
# This assumes the SDL source is available in vendored/SDL
add_subdirectory(vendored/SDL EXCLUDE_FROM_ALL)
# Create your game executable target as usual
add_executable(hello WIN32 hello.c)
# Link to the actual SDL3 library.
target_link_libraries(hello PRIVATE SDL3::SDL3)
```
Build:
```sh
cmake -S . -B build
cmake --build build
```
Run:
- On Windows the executable is in the build Debug directory:
```sh
cd build/Debug
./hello
```
- On other platforms the executable is in the build directory:
```sh
cd build
./hello
```
A more complete example is available at:
https://github.com/Ravbug/sdl3-sample
Additional information and troubleshooting is available in [README-cmake.md](README-cmake.md)
+38
View File
@@ -0,0 +1,38 @@
# Introduction to SDL with Emscripten
First, you should have the Emscripten SDK installed from:
https://emscripten.org/docs/getting_started/downloads.html
We'll start by creating a simple project to build and run [hello.c](hello.c)
## Building SDL
Once you have a command line interface with the Emscripten SDK set up and you've changed directory to the SDL directory, you can build SDL like this:
```sh
mkdir hello
cd hello
emcmake cmake ..
emmake make
```
## Building your app
In this case we'll just run a simple command to compile our source with the SDL library we just built:
```sh
emcc -o index.html ../docs/hello.c -I../include -L. -lSDL3
```
## Running your app
You can now run your app by pointing a webserver at your build directory and connecting a web browser to it.
## More information
A more complete example is available at:
https://github.com/Ravbug/sdl3-sample
Additional information and troubleshooting is available in [README-emscripten.md](README-emscripten.md)
+15
View File
@@ -0,0 +1,15 @@
# Introduction to SDL with Visual Studio
The easiest way to use SDL is to include it as a subproject in your project.
We'll start by creating a simple project to build and run [hello.c](hello.c)
- Create a new project in Visual Studio, using the C++ Empty Project template
- Add hello.c to the Source Files
- Right click the solution, select add an existing project, navigate to VisualC/SDL and add SDL.vcxproj
- Select your main project and go to Project -> Project Dependencies and select SDL3
- Select your main project and go to Project -> Properties, set the filter at the top to "All Configurations" and "All Platforms", select VC++ Directories and add the SDL include directory to "Include Directories"
- Select your main project and go to Project -> Add Reference and select SDL3
- Build and run!
+16
View File
@@ -0,0 +1,16 @@
# Introduction to SDL with Xcode
The easiest way to use SDL is to include it as a subproject in your project.
We'll start by creating a simple project to build and run [hello.c](hello.c)
- Create a new project in Xcode, using the App template and selecting Objective C as the language
- Remove the .h and .m files that were automatically added to the project
- Remove the main storyboard that was automatically added to the project
- On iOS projects, select the project, select the main target, select the Info tab, look for "Custom iOS Target Properties", and remove "Main storyboard base file name" and "Application Scene Manifest"
- Right click the project and select "Add Files to [project]", navigate to the SDL docs directory and add the file hello.c
- Right click the project and select "Add Files to [project]", navigate to the SDL Xcode/SDL directory and add SDL.xcodeproj
- Select the project, select the main target, select the General tab, look for "Frameworks, Libaries, and Embedded Content", and add SDL3.framework
- Build and run!
+37 -128
View File
@@ -6,7 +6,7 @@ The CMake build system is supported on the following platforms:
* FreeBSD
* Linux
* Microsoft Visual C
* Microsoft Visual Studio
* MinGW and Msys
* macOS, iOS, tvOS, and visionOS with support for XCode
* Android
@@ -20,42 +20,55 @@ The CMake build system is supported on the following platforms:
* QNX 7.x/8.x
* RiscOS
## Building SDL
## Building SDL on Windows
Assuming the source tree of SDL is located at `~/sdl`,
this will configure and build SDL in the `~/build` directory:
Assuming you're in the SDL source directory, building and installing to C:/SDL can be done with:
```sh
cmake -S ~/sdl -B ~/build
cmake --build ~/build
cmake -S . -B build
cmake --build build --config RelWithDebInfo
cmake --install build --config RelWithDebInfo --prefix C:/SDL
```
Installation can be done using:
## Building SDL on UNIX
SDL will build with very few dependencies, but for full functionality you should install the packages detailed in [README-linux.md](README-linux.md).
Assuming you're in the SDL source directory, building and installing to /usr/local can be done with:
```sh
cmake --install ~/build --prefix /usr/local # '--install' requires CMake 3.15, or newer
cmake -S . -B build
cmake --build build
sudo cmake --install build --prefix /usr/local
```
This will install SDL to /usr/local.
## Building SDL on macOS
### Building SDL tests
Assuming you're in the SDL source directory, building and installing to ~/SDL can be done with:
```sh
cmake -S . -B build -DSDL_FRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
cmake --build build
cmake --install build --prefix ~/SDL
```
## Building SDL tests
You can build the SDL test programs by adding `-DSDL_TESTS=ON` to the first cmake command above:
```sh
cmake -S ~/sdl -B ~/build -DSDL_TEST_LIBRARY=ON -DSDL_TESTS=ON
cmake -S . -B build -DSDL_TESTS=ON
```
and then building normally. In this example, the test programs will be built and can be run from `~/build/tests/`.
and then building normally. The test programs will be built and can be run from `build/test/`.
### Building SDL examples
## Building SDL examples
You can build the SDL example programs by adding `-DSDL_EXAMPLES=ON` to the first cmake command above:
```sh
cmake -S ~/sdl -B ~/build -DSDL_EXAMPLES=ON
cmake -S . -B build -DSDL_EXAMPLES=ON
```
and then building normally. In this example, the example programs will be built and can be run from `~/build/examples/`.
and then building normally. The example programs will be built and can be run from `build/examples/`.
## Including SDL in your project
SDL can be included in your project in 2 major ways:
- using a system SDL library, provided by your (*nix) distribution or a package manager
- using a system SDL library, provided by your (UNIX) distribution or a package manager
- using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
@@ -131,6 +144,13 @@ Exceptions exist:
- some platforms don't support dynamic libraries, so only `-DSDL_STATIC=ON` makes sense.
- a static Apple framework is not supported
### Man pages
Configuring with `-DSDL_INSTALL_DOCS=TRUE` installs man pages.
We recommend package managers of unix distributions to install SDL3's man pages.
This adds an extra build-time dependency on Perl.
### Pass custom compile options to the compiler
- Use [`CMAKE_<LANG>_FLAGS`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html) to pass extra
@@ -174,7 +194,7 @@ Only shared frameworks are supported, no static ones.
#### Platforms
Use `-DCMAKE_PLATFORM_NAME=<value>` to configure the platform. CMake can target only one platform at a time.
Use `-DCMAKE_SYSTEM_NAME=<value>` to configure the platform. CMake can target only one platform at a time.
| Apple platform | `CMAKE_SYSTEM_NAME` value |
|-----------------|---------------------------|
@@ -343,114 +363,3 @@ However, by default CMake builds static libraries as non-relocatable.
Configuring SDL with `-DCMAKE_POSITION_INDEPENDENT_CODE=ON` will result in a static `libSDL3.a` library
which you can link against to create a shared library.
## Help, it doesn't work!
Below, a SDL3 CMake project can be found that builds 99.9% of time (assuming you have internet connectivity).
When you have a problem with building or using SDL, please modify it until it reproduces your issue.
```cmake
cmake_minimum_required(VERSION 3.16)
project(sdl_issue)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!! !!!!!!
# !!!!!! This CMake script is not using "CMake best practices". !!!!!!
# !!!!!! Don't use it in your project. !!!!!!
# !!!!!! !!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# 1. Try system SDL3 package first
find_package(SDL3 QUIET)
if(SDL3_FOUND)
message(STATUS "Using SDL3 via find_package")
endif()
# 2. Try using a vendored SDL library
if(NOT SDL3_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL/CMakeLists.txt")
add_subdirectory(SDL EXCLUDE_FROM_ALL)
message(STATUS "Using SDL3 via add_subdirectory")
set(SDL3_FOUND TRUE)
endif()
# 3. Download SDL, and use that.
if(NOT SDL3_FOUND)
include(FetchContent)
set(SDL_SHARED TRUE CACHE BOOL "Build a SDL shared library (if available)")
set(SDL_STATIC TRUE CACHE BOOL "Build a SDL static library (if available)")
FetchContent_Declare(
SDL
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG main # Replace this with a particular git tag or git hash
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
message(STATUS "Using SDL3 via FetchContent")
FetchContent_MakeAvailable(SDL)
set_property(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/_deps/sdl-src" PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
file(WRITE main.c [===========================================[
/**
* Modify this source such that it reproduces your problem.
*/
/* START of source modifications */
#include <SDL3/SDL.h>
/*
* SDL3/SDL_main.h is explicitly not included such that a terminal window would appear on Windows.
*/
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("SDL_Init failed (%s)", SDL_GetError());
return 1;
}
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
if (!SDL_CreateWindowAndRenderer("SDL issue", 640, 480, 0, &window, &renderer)) {
SDL_Log("SDL_CreateWindowAndRenderer failed (%s)", SDL_GetError());
SDL_Quit();
return 1;
}
while (1) {
int finished = 0;
SDL_Event event;
while (SDL_PollEvent(&event)) {
if (event.type == SDL_EVENT_QUIT) {
finished = 1;
break;
}
}
if (finished) {
break;
}
SDL_SetRenderDrawColor(renderer, 80, 80, 80, SDL_ALPHA_OPAQUE);
SDL_RenderClear(renderer);
SDL_RenderPresent(renderer);
}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
/* END of source modifications */
]===========================================])
add_executable(sdl_issue main.c)
target_link_libraries(sdl_issue PRIVATE SDL3::SDL3)
# target_link_libraries(sdl_issue PRIVATE SDL3::SDL3-shared)
# target_link_libraries(sdl_issue PRIVATE SDL3::SDL3-static)
```
+1 -1
View File
@@ -57,7 +57,7 @@ If you had already forked the repository, you may update it from the web page us
Code formatting is done using a custom `.clang-format` file, you can learn more about how to run it [here](https://clang.llvm.org/docs/ClangFormat.html).
Some legacy code may not be formatted, as such avoid formatting the whole file at once and only format around your changes.
Some legacy code may not be formatted, so please avoid formatting the whole file at once and only format around your changes.
For your commit message to be properly displayed on GitHub, it should contain:
+3 -3
View File
@@ -239,13 +239,13 @@ If you want to build with thread support, something like this works:
```bash
mkdir build
cd build
emcmake cmake -DSDL_THREADS=On ..
emcmake cmake -DSDL_THREADS=ON ..
# you can also do `emcmake cmake -G Ninja ..` and then use `ninja` instead of this command.
emmake make -j4
```
To build the tests, add `-DSDL_TESTS=On` to the `emcmake cmake` command line.
To build the examples, add `-DSDL_EXAMPLES=On` to the `emcmake cmake` command line.
To build the tests, add `-DSDL_TESTS=ON` to the `emcmake cmake` command line.
To build the examples, add `-DSDL_EXAMPLES=ON` to the `emcmake cmake` command line.
## Building your app
+3 -6
View File
@@ -1,10 +1,10 @@
iOS
======
Building the Simple DirectMedia Layer for iOS 9.0+
Building the Simple DirectMedia Layer for iOS 11.0+
==============================================================================
Requirements: macOS 10.9 or later and the iOS 9.0 or newer SDK.
Please note that building SDL requires at least Xcode 12.2 and the iOS 14.2 SDK.
Instructions:
@@ -185,9 +185,6 @@ Windows:
Textures:
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, and SDL_PIXELFORMAT_RGB24 pixel formats.
Loading Shared Objects:
This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_ios.h.
Notes -- CoreBluetooth.framework
==============================================================================
@@ -249,7 +246,7 @@ Note that if you are using main callbacks instead of a standard C main() functio
Deploying to older versions of iOS
==============================================================================
SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 11.0
In order to do that you need to download an older version of Xcode:
https://developer.apple.com/download/more/?name=Xcode
+3 -6
View File
@@ -13,7 +13,7 @@ To build SDL using the command line, use the CMake build script:
```bash
mkdir build
cd build
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11
cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
cmake --build .
sudo cmake --install .
```
@@ -25,15 +25,12 @@ You can also build SDL as a Universal library (a single binary for both
```bash
mkdir build
cd build
cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11
cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
cmake --build .
sudo cmake --install .
```
Please note that building SDL requires at least Xcode 12.2 and the 11.0 SDK.
PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
32-bit Intel and macOS 10.8 runtime support has been officially dropped as
of SDL 2.24.0.
Please note that building SDL requires at least Xcode 12.2 and the macOS 11.0 SDK.
To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode.
+9 -1
View File
@@ -1031,6 +1031,9 @@ The following structures have been removed:
SDL_Keycode is now Uint32 and the SDLK_* constants are now defines instead of an enum, to more clearly reflect that they are a subset of the possible values of an SDL_Keycode.
In addition to the `SDLK_SCANCODE_MASK` bit found on key codes that directly map to scancodes, there is now the
`SDLK_EXTENDED_MASK` bit used to denote key codes that don't have a corresponding scancode, and aren't a unicode value.
The following symbols have been removed:
* KMOD_RESERVED - No replacement. A bit named "RESERVED" probably shouldn't be used in an app, but if you need it, this was equivalent to KMOD_SCROLL (0x8000) in SDL2.
@@ -1262,6 +1265,7 @@ The following symbols have been renamed:
The following functions have been removed:
* SDL_FreeFormat()
* SDL_SetPixelFormatPalette()
* SDL_CalculateGammaRamp()
The following macros have been removed:
* SDL_Colour - use SDL_Color instead
@@ -2177,7 +2181,7 @@ Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFul
SDL_WINDOW_FULLSCREEN_DESKTOP has been removed, and you can call SDL_GetWindowFullscreenMode() to see whether an exclusive fullscreen mode will be used or the borderless fullscreen desktop mode will be used when the window is fullscreen.
SDL_SetWindowBrightness and SDL_SetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
SDL_SetWindowBrightness(), SDL_GetWindowBrightness, SDL_SetWindowGammaRamp(), and SDL_GetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
Programs which have access to shaders can implement more robust versions of those functions using custom shader code rendered as a post-process effect.
@@ -2221,6 +2225,10 @@ The following functions have been removed:
* SDL_CreateWindowFrom() - use SDL_CreateWindowWithProperties() with the properties that allow you to wrap an existing window
* SDL_SetWindowInputFocus() - use SDL_RaiseWindow() instead
* SDL_SetWindowModalFor() - use SDL_SetWindowParent() with SDL_SetWindowModal() instead
* SDL_SetWindowBrightness() - use a shader or other in-game effect.
* SDL_GetWindowBrightness() - use a shader or other in-game effect.
* SDL_SetWindowGammaRamp() - use a shader or other in-game effect.
* SDL_GetWindowGammaRamp() - use a shader or other in-game effect.
The SDL_Window id type is named SDL_WindowID
-188
View File
@@ -1,188 +0,0 @@
Raspberry Pi
============
Requirements:
Raspberry Pi OS (other Linux distros may work as well).
In modern times, the Raspberry Pi works mostly like any other Linux device:
for video, you can use X11, Wayland, or KMSDRM. For audio, you can use ALSA,
PulseAudio, or PipeWire, etc. OpenGL, OpenGL ES, and Vulkan are known to work.
There is a video backend in SDL called "rpi" that uses a deprecated Broadcom
interface (named "dispmanx") to draw directly to the console without X11.
Newer Raspberry Pi OS releases don't support this (and work fine with our
"kmsdrm" backend for the same purposes, a standard Linux interface). Don't
panic if you can't use this backend, or CMake says it can't find libraries it
needs for this.
SDL has, in past times, worked on the original Raspberry Pi and the RPi 2, but
these devices are no longer targets we actively test; if they broke, please
report bugs or send patches!
The Raspberry Pi 3 and later (in 32-bit and 64-bit mode) are still known to
work well at the time of this writing. The Raspberry Pi Zero and Zero 2 are
also known to work well.
## Documentation Out Of Date
The rest of this document is likely out of date; a lot has changed in recent
years in both SDL and the Raspberry Pi universe, and this document has not
been updated to reflect those details. Take the rest of this information with
a grain of salt!
NEON
----
If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
that SDL will select some otherwise-disabled highly-optimized code. The
original Pi and Pi Zero units don't have NEON; everything from the Pi2/PiZero2
and later do.
Cross compiling from x86 Linux
------------------------------
To cross compile SDL for Raspbian from your desktop machine, you'll need a
Raspbian system root and the cross compilation tools. We'll assume these tools
will be placed in /opt/rpi-tools
sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
You'll also need a Raspbian binary image.
Get it from: http://downloads.raspberrypi.org/raspbian_latest
After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
Let's assume the sysroot will be built in /opt/rpi-sysroot.
export SYSROOT=/opt/rpi-sysroot
sudo kpartx -a -v <path_to_raspbian_image>.img
sudo mount -o loop /dev/mapper/loop0p2 /mnt
sudo cp -r /mnt $SYSROOT
sudo apt-get install qemu binfmt-support qemu-user-static
sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
sudo mount --bind /dev $SYSROOT/dev
sudo mount --bind /proc $SYSROOT/proc
sudo mount --bind /sys $SYSROOT/sys
Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
sudo chroot $SYSROOT
apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
exit
sudo umount $SYSROOT/dev
sudo umount $SYSROOT/proc
sudo umount $SYSROOT/sys
sudo umount /mnt
There's one more fix required, as the libdl.so symlink uses an absolute path
which doesn't quite work in our setup.
sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
The final step is compiling SDL itself.
export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
cd <SDL SOURCE>
mkdir -p build;cd build
LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl3-installed --disable-pulseaudio --disable-esd
make
make install
To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
perl -w -pi -e "s#$PWD/rpi-sdl3-installed#/usr/local#g;" ./rpi-sdl3-installed/lib/libSDL3.la ./rpi-sdl3-installed/lib/pkgconfig/sdl3.pc
Apps don't work or poor video/audio performance
-----------------------------------------------
If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
update the RPi's firmware. Note that doing so will fix these problems, but it
will also render the CMA - Dynamic Memory Split functionality useless.
Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
low in general, specially if a 1080p TV is hooked up.
See here how to configure this setting: http://elinux.org/RPiconfig
Using a fixed gpu_mem=128 is the best option (specially if you updated the
firmware, using CMA probably won't work, at least it's the current case).
No input
--------
Make sure you belong to the "input" group.
sudo usermod -aG input `whoami`
No HDMI Audio
-------------
If you notice that ALSA works but there's no audio over HDMI, try adding:
hdmi_drive=2
to your config.txt file and reboot.
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
Text Input API support
----------------------
The Text Input API is supported, with translation of scan codes done via the
kernel symbol tables. For this to work, SDL needs access to a valid console.
If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that
your app has read access to one of the following:
* /proc/self/fd/0
* /dev/tty
* /dev/tty[0...6]
* /dev/vc/0
* /dev/console
This is usually not a problem if you run from the physical terminal (as opposed
to running from a pseudo terminal, such as via SSH). If running from a PTS, a
quick workaround is to run your app as root or add yourself to the tty group,
then re-login to the system.
sudo usermod -aG tty `whoami`
The keyboard layout used by SDL is the same as the one the kernel uses.
To configure the layout on Raspbian:
sudo dpkg-reconfigure keyboard-configuration
To configure the locale, which controls which keys are interpreted as letters,
this determining the CAPS LOCK behavior:
sudo dpkg-reconfigure locales
OpenGL problems
---------------
If you have desktop OpenGL headers installed at build time in your RPi or cross
compilation environment, support for it will be built in. However, the chipset
does not actually have support for it, which causes issues in certain SDL apps
since the presence of OpenGL support supersedes the ES/ES2 variants.
The workaround is to disable OpenGL at configuration time:
./configure --disable-video-opengl
Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
environment variable:
export SDL_RENDER_DRIVER=opengles2
Notes
-----
* When launching apps remotely (via SSH), SDL can prevent local keystrokes from
leaking into the console only if it has root privileges. Launching apps locally
does not suffer from this issue.
-113
View File
@@ -1,113 +0,0 @@
Using SDL with Microsoft Visual C++
===================================
#### by Lion Kimbro with additions by James Turk
You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
yourself.
### Building SDL
0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
the `Platform Toolset`.
If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
panel in the _FileView_ tab), and selecting `Build`.
You may get a few warnings, but you should not get any errors.
Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
- `./VisualC/Win32/Debug/SDL3.dll` or `./VisualC/Win32/Release/SDL3.dll`
- `./VisualC/Win32/Debug/SDL3.lib` or `./VisualC/Win32/Release/SDL3.lib`
_Note for the `x64` versions, just replace `Win32` in the path with `x64`_
### Creating a Project with SDL
- Create a project as a `Win32 Application`.
- Create a C++ file for your project.
- Set the C runtime to `Multi-threaded DLL` in the menu:
`Project|Settings|C/C++ tab|Code Generation|Runtime Library `.
- Add the SDL `include` directory to your list of includes in the menu:
`Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
*VC7 Specific: Instead of doing this, I find it easier to add the
include and library directories to the list that VC7 keeps. Do this by
selecting Tools|Options|Projects|VC++ Directories and under the "Show
Directories For:" dropbox select "Include Files", and click the "New
Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
The "include directory" I am referring to is the `./include` folder.
Now we're going to use the files that we had created earlier in the *Build SDL* step.
Copy the following file into your Project directory:
- `SDL3.dll`
Add the following file to your project (It is not necessary to copy it to your project directory):
- `SDL3.lib`
To add them to your project, right click on your project, and select
`Add files to project`.
**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
(e.g. Release,Debug).**
### Hello SDL
Here's a sample SDL snippet to verify everything is setup in your IDE:
```c
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h> // only include this one in the source file with main()!
int main( int argc, char* argv[] )
{
const int WIDTH = 640;
const int HEIGHT = 480;
SDL_Window* window = NULL;
SDL_Renderer* renderer = NULL;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("Hello SDL", WIDTH, HEIGHT, 0);
renderer = SDL_CreateRenderer(window, NULL);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
```
### That's it!
I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
### Credits
Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port.
This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org).
Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com).
Minor Fixes and Visual C++ 7 Information (in italic) was added by [James Turk](mailto:james@conceptofzero.net)
+4 -4
View File
@@ -10,10 +10,10 @@ Credit to
Building
--------
To build for the PSVita, make sure you have vitasdk and cmake installed and run:
```
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
```sh
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
```
+3 -1
View File
@@ -18,7 +18,9 @@ Details are here: https://github.com/libsdl-org/SDL/issues/5186
## MinGW-w64 compiler support
SDL can be built with MinGW-w64 and CMake. First, you need to install and set up the MSYS2 environment, which provides the MinGW-w64 toolchain. Install MSYS2, typically to `C:\msys64`, and follow the instructions on the MSYS2 wiki to use the MinGW-w64 shell to update all components in the MSYS2 environment. This generally amounts to running `pacman -Syuu` from the mingw64 shell, but refer to MSYS2's documentation for more details. Once the MSYS2 environment has been updated, install the x86_64 MinGW toolchain from the mingw64 shell with the command `pacman -S mingw-w64-x86_64-toolchain`. (You can additionally install `mingw-w64-i686-toolchain` if you intend to build 32-bit binaries as well. The remainder of this section assumes you only want to build 64-bit binaries.)
SDL can be built with MinGW-w64 and CMake. Minimum tested MinGW-w64 version is 8.0.3.
On a Windows host, you first need to install and set up the MSYS2 environment, which provides the MinGW-w64 toolchain. Install MSYS2, typically to `C:\msys64`, and follow the instructions on the MSYS2 wiki to use the MinGW-w64 shell to update all components in the MSYS2 environment. This generally amounts to running `pacman -Syuu` from the mingw64 shell, but refer to MSYS2's documentation for more details. Once the MSYS2 environment has been updated, install the x86_64 MinGW toolchain from the mingw64 shell with the command `pacman -S mingw-w64-x86_64-toolchain`. (You can additionally install `mingw-w64-i686-toolchain` if you intend to build 32-bit binaries as well. The remainder of this section assumes you only want to build 64-bit binaries.)
To build and install SDL, you can use PowerShell or any CMake-compatible IDE. First, install CMake, Ninja, and Git. These tools can be installed using any number of tools, such as the MSYS2's `pacman`, `winget`, `Chocolatey`, or by manually downloading and running the installers. Clone SDL to an appropriate location with `git` and run the following commands from the root of the cloned repository:
+4 -6
View File
@@ -19,21 +19,19 @@ in the file "LICENSE.txt".
Information on building SDL with CMake is available in [README-cmake.md](README-cmake.md)
The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
the "include" subdirectory and the programs in the "examples" subdirectory.
The header files and test programs are well commented and always up to date.
Information on reporting bugs and contributing is available in [README-contributing.md](README-contributing.md)
More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
- [High DPI Support](README-highdpi.md)
- [main()](README-main-functions.md)
- [Porting information](README-porting.md)
- [Migrating from SDL 2.0](README-migration.md)
- [Supported Platforms](README-platforms.md)
- [main()](README-main-functions.md)
- [High DPI Support](README-highdpi.md)
- [Touch](README-touch.md)
- [Versions](README-versions.md)
- [Visual Studio](README-visualc.md)
- [Android](README-android.md)
- [Emscripten](README-emscripten.md)
@@ -45,10 +43,10 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd
- [PS2](README-ps2.md)
- [PSP](README-psp.md)
- [PSVita](README-vita.md)
- [Raspberry Pi](README-raspberrypi.md)
- [RISC OS](README-riscos.md)
- [Windows GDK](README-gdk.md)
- [Windows](README-windows.md)
- [Porting information](README-porting.md)
If you need help with the library, or just want to discuss SDL related
issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
+68
View File
@@ -0,0 +1,68 @@
/*
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
#define SDL_MAIN_USE_CALLBACKS 1 /* use the callbacks instead of main() */
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
static SDL_Window *window = NULL;
static SDL_Renderer *renderer = NULL;
/* This function runs once at startup. */
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
{
/* Create the window */
if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) {
SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError());
return SDL_APP_FAILURE;
}
return SDL_APP_CONTINUE;
}
/* 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_KEY_DOWN ||
event->type == SDL_EVENT_QUIT) {
return SDL_APP_SUCCESS; /* end the program, reporting success to the OS. */
}
return SDL_APP_CONTINUE;
}
/* This function runs once per frame, and is the heart of the program. */
SDL_AppResult SDL_AppIterate(void *appstate)
{
const char *message = "Hello World!";
int w = 0, h = 0;
float x, y;
const float scale = 4.0f;
/* Center the message and scale it up */
SDL_GetRenderOutputSize(renderer, &w, &h);
SDL_SetRenderScale(renderer, scale, scale);
x = ((w / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE * SDL_strlen(message)) / 2;
y = ((h / scale) - SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE) / 2;
/* Draw the message */
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderDebugText(renderer, x, y, message);
SDL_RenderPresent(renderer);
return SDL_APP_CONTINUE;
}
/* This function runs once at shutdown. */
void SDL_AppQuit(void *appstate, SDL_AppResult result)
{
}
@@ -73,12 +73,11 @@ SDL_AppResult SDL_AppIterate(void *appstate)
static float samples[512]; /* this will feed 512 samples each frame until we get to our maximum. */
int i;
/* generate a 440Hz pure tone */
for (i = 0; i < SDL_arraysize(samples); i++) {
/* You don't have to care about this math; we're just generating a simple sine wave as we go.
https://en.wikipedia.org/wiki/Sine_wave */
const float time = total_samples_generated / 8000.0f;
const int sine_freq = 500; /* run the wave at 500Hz */
samples[i] = SDL_sinf(6.283185f * sine_freq * time);
const int freq = 440;
const int phase = (total_samples_generated * freq) % 8000;
samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0);
total_samples_generated++;
}
@@ -33,12 +33,11 @@ static void SDLCALL FeedTheAudioStreamMore(void *userdata, SDL_AudioStream *astr
const int total = SDL_min(additional_amount, SDL_arraysize(samples));
int i;
/* generate a 440Hz pure tone */
for (i = 0; i < total; i++) {
/* You don't have to care about this math; we're just generating a simple sine wave as we go.
https://en.wikipedia.org/wiki/Sine_wave */
const float time = total_samples_generated / 8000.0f;
const int sine_freq = 500; /* run the wave at 500Hz */
samples[i] = SDL_sinf(6.283185f * sine_freq * time);
const int freq = 440;
const int phase = (total_samples_generated * freq) % 8000;
samples[i] = (float)SDL_sin(phase * 2 * SDL_PI_D / 8000.0);
total_samples_generated++;
}
+1 -1
View File
@@ -207,7 +207,7 @@
<li><a href="/@project_name@/@category_name@/@example_name@">@example_name@</a></li>
</ul>
</nav>
<h1>@project_name@ example: @category_name@/@example_name@</h1>
<hr/>
<div id="example-description">@description@</div>
<div class="canvas-container">
<canvas
+1 -1
View File
@@ -20,7 +20,7 @@
*/
/**
* Main include header for the SDL library, version 3.1.8
* Main include header for the SDL library, version 3.1.10
*
* It is almost always best to include just this one header instead of
* picking out individual headers included here. There are exceptions to
+5 -5
View File
@@ -118,8 +118,7 @@ extern "C" {
*
* If the program is not running under a debugger, SDL_TriggerBreakpoint will
* likely terminate the app, possibly without warning. If the current platform
* isn't supported (SDL doesn't know how to trigger a breakpoint), this macro
* does nothing.
* isn't supported, this macro is left undefined.
*
* \threadsafety It is safe to call this macro from any thread.
*
@@ -127,10 +126,12 @@ extern "C" {
*/
#define SDL_TriggerBreakpoint() TriggerABreakpointInAPlatformSpecificManner
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && _MSC_VER >= 1310
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif defined(_MSC_VER) && defined(_M_IX86)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(ANDROID)
#include <assert.h>
#define SDL_TriggerBreakpoint() assert(0)
@@ -152,8 +153,7 @@ extern "C" {
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
/* SDL_TriggerBreakpoint is intentionally left undefined on unknown platforms. */
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
+14 -14
View File
@@ -67,14 +67,14 @@
*
* ## Best Practices
*
* Simple non-blocking i/o--for an app that just wants to pick up data
* Simple non-blocking I/O--for an app that just wants to pick up data
* whenever it's ready without losing framerate waiting on disks to spin--can
* use whatever pattern works well for the program. In this case, simply call
* SDL_ReadAsyncIO, or maybe SDL_LoadFileAsync, as needed. Once a frame, call
* SDL_GetAsyncIOResult to check for any completed tasks and deal with the
* data as it arrives.
*
* If two separate pieces of the same program need their own i/o, it is legal
* If two separate pieces of the same program need their own I/O, it is legal
* for each to create their own queue. This will prevent either piece from
* accidentally consuming the other's completed tasks. Each queue does require
* some amount of resources, but it is not an overwhelming cost. Do not make a
@@ -83,7 +83,7 @@
* were submitted, so it doesn't generally matter what order tasks are
* started.
*
* One async i/o queue can be shared by multiple threads, or one thread can
* One async I/O queue can be shared by multiple threads, or one thread can
* have more than one queue, but the most efficient way--if ruthless
* efficiency is the goal--is to have one queue per thread, with multiple
* threads working in parallel, and attempt to keep each queue loaded with
@@ -213,7 +213,7 @@ typedef struct SDL_AsyncIOQueue SDL_AsyncIOQueue;
* \returns a pointer to the SDL_AsyncIO structure that is created or NULL on
* failure; call SDL_GetError() for more information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CloseAsyncIO
* \sa SDL_ReadAsyncIO
@@ -234,7 +234,7 @@ extern SDL_DECLSPEC SDL_AsyncIO * SDLCALL SDL_AsyncIOFromFile(const char *file,
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
@@ -269,7 +269,7 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetAsyncIOSize(SDL_AsyncIO *asyncio);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WriteAsyncIO
* \sa SDL_CreateAsyncIOQueue
@@ -306,7 +306,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadAsyncIO(SDL_AsyncIO *asyncio, void *ptr
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_ReadAsyncIO
* \sa SDL_CreateAsyncIOQueue
@@ -358,7 +358,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteAsyncIO(SDL_AsyncIO *asyncio, void *pt
* \threadsafety It is safe to call this function from any thread, but two
* threads should not attempt to close the same object.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flush, SDL_AsyncIOQueue *queue, void *userdata);
@@ -373,7 +373,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseAsyncIO(SDL_AsyncIO *asyncio, bool flu
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_DestroyAsyncIOQueue
* \sa SDL_GetAsyncIOResult
@@ -407,7 +407,7 @@ extern SDL_DECLSPEC SDL_AsyncIOQueue * SDLCALL SDL_CreateAsyncIOQueue(void);
* no other thread is waiting on the queue with
* SDL_WaitAsyncIOResult.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue);
@@ -431,7 +431,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyAsyncIOQueue(SDL_AsyncIOQueue *queue
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WaitAsyncIOResult
*/
@@ -475,7 +475,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAsyncIOResult(SDL_AsyncIOQueue *queue, S
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SignalAsyncIOQueue
*/
@@ -499,7 +499,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitAsyncIOResult(SDL_AsyncIOQueue *queue,
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_WaitAsyncIOResult
*/
@@ -531,7 +531,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SignalAsyncIOQueue(SDL_AsyncIOQueue *queue)
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_LoadFile_IO
*/
+41 -3
View File
@@ -745,7 +745,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID devid);
@@ -759,7 +759,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePhysical(SDL_AudioDeviceID dev
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_IsAudioDevicePlayback(SDL_AudioDeviceID devid);
@@ -942,7 +942,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid);
* Binding a stream to a device will set its output format for playback
* devices, and its input format for recording devices, so they match the
* device's settings. The caller is welcome to change the other end of the
* stream's format at any time.
* stream's format at any time with SDL_SetAudioStreamFormat().
*
* \param devid an audio device to bind a stream to.
* \param streams an array of audio streams to bind.
@@ -1104,6 +1104,12 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *strea
* next sound file, and start putting that new data while the previous sound
* file is still queued, and everything will still play back correctly.
*
* If a stream is bound to a device, then the format of the side of the stream
* bound to a device cannot be changed (src_spec for recording devices,
* dst_spec for playback devices). Attempts to make a change to this side will
* be ignored, but this will not report an error. The other side's format can
* be changed.
*
* \param stream the stream the format is being changed.
* \param src_spec the new format of the audio input; if NULL, it is not
* changed.
@@ -1298,6 +1304,11 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt
* race condition hasn't changed the format while this call is setting the
* channel map.
*
* Unlike attempting to change the stream's format, the input channel map on a
* stream bound to a recording device is permitted to change at any time; any
* data added to the stream from the device after this call will have the new
* mapping, but previously-added data will still have the prior mapping.
*
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
@@ -1349,6 +1360,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStre
* race condition hasn't changed the format while this call is setting the
* channel map.
*
* Unlike attempting to change the stream's format, the output channel map on
* a stream bound to a recording device is permitted to change at any time;
* any data added to the stream after this call will have the new mapping, but
* previously-added data will still have the prior mapping. When the channel
* map doesn't match the hardware's channel layout, SDL will convert the data
* before feeding it to the device for playback.
*
* \param stream the SDL_AudioStream to change.
* \param chmap the new channel map, NULL to reset to default.
* \param count The number of channels in the map.
@@ -1577,6 +1595,26 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *str
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream);
/**
* Use this function to query if an audio device associated with a stream is
* paused.
*
* Unlike in SDL2, audio devices start in an _unpaused_ state, since an app
* has to bind a stream before any audio will flow.
*
* \param stream the audio stream associated with the audio device to query.
* \returns true if device is valid and paused, false otherwise.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
*
* \sa SDL_PauseAudioStreamDevice
* \sa SDL_ResumeAudioStreamDevice
*/
extern SDL_DECLSPEC bool SDLCALL SDL_AudioStreamDevicePaused(SDL_AudioStream *stream);
/**
* Lock an audio stream for serialized access.
*
+1 -1
View File
@@ -78,7 +78,7 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x)
return -1;
}
return _SDL_bsr_watcom(x);
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) && _MSC_VER >= 1400
unsigned long index;
if (_BitScanReverse(&index, x)) {
return (int)index;
+1 -1
View File
@@ -312,7 +312,7 @@ typedef enum SDL_FileDialogType
* callback may be invoked from the same thread or from a
* different one, depending on the OS's constraints.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_FileDialogType
* \sa SDL_DialogFileCallback
+9 -14
View File
@@ -38,10 +38,10 @@
* at all).
*
* There is other forms of control, too: SDL_PeepEvents() has more
* functionality at the cost of more complexity, and SDL_WaitEvents() can
* block the process until something interesting happens, which might be
* beneficial for certain types of programs on low-power hardware. One may
* also call SDL_AddEventWatch() to set a callback when new events arrive.
* functionality at the cost of more complexity, and SDL_WaitEvent() can block
* the process until something interesting happens, which might be beneficial
* for certain types of programs on low-power hardware. One may also call
* SDL_AddEventWatch() to set a callback when new events arrive.
*
* The app is free to generate their own events, too: SDL_PushEvent allows the
* app to put events onto the queue for later retrieval; SDL_RegisterEvents
@@ -1377,8 +1377,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event);
typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
/**
* Set up a filter to process all events before they change internal state and
* are posted to the internal event queue.
* Set up a filter to process all events before they are added to the internal
* event queue.
*
* If you just want to see events without modifying them or preventing them
* from being queued, you should use SDL_AddEventWatch() instead.
*
* If the filter function returns true when called, then the event will be
* added to the internal queue. If it returns false, then the event will be
@@ -1392,17 +1395,9 @@ typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event);
* interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
* application at the next event poll.
*
* There is one caveat when dealing with the SDL_QuitEvent event type. The
* event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will be
* closed, otherwise the window will remain open if possible.
*
* Note: Disabled events never make it to the event filter function; see
* SDL_SetEventEnabled().
*
* Note: If you just want to inspect events without filtering, you should use
* SDL_AddEventWatch() instead.
*
* Note: Events pushed onto the queue with SDL_PushEvent() get passed through
* the event filter, but events pushed onto the queue with SDL_PeepEvents() do
* not.
+7 -1
View File
@@ -313,6 +313,9 @@ typedef enum SDL_EnumerationResult
* terminate the enumeration early, and dictate the return value of the
* enumeration function itself.
*
* `dirname` is guaranteed to end with a path separator ('\\' on Windows, '/'
* on most other platforms).
*
* \param userdata an app-controlled pointer that is passed to the callback.
* \param dirname the directory that is being enumerated.
* \param fname the next entry in the enumeration.
@@ -480,11 +483,14 @@ extern SDL_DECLSPEC char ** SDLCALL SDL_GlobDirectory(const char *path, const ch
* platforms without this concept, this would cause surprises with file access
* outside of SDL.
*
* The returned path is guaranteed to end with a path separator ('\\' on
* Windows, '/' on most other platforms).
*
* \returns a UTF-8 string of the current working directory in
* platform-dependent notation. NULL if there's a problem. This
* should be freed with SDL_free() when it is no longer needed.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC char * SDLCALL SDL_GetCurrentDirectory(void);
+82 -25
View File
@@ -334,7 +334,6 @@ typedef struct SDL_GPUDevice SDL_GPUDevice;
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_CreateGPUBuffer
* \sa SDL_SetGPUBufferName
* \sa SDL_UploadToGPUBuffer
* \sa SDL_DownloadFromGPUBuffer
* \sa SDL_CopyGPUBufferToBuffer
@@ -374,7 +373,6 @@ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer;
* \since This struct is available since SDL 3.1.3
*
* \sa SDL_CreateGPUTexture
* \sa SDL_SetGPUTextureName
* \sa SDL_UploadToGPUTexture
* \sa SDL_DownloadFromGPUTexture
* \sa SDL_CopyGPUTextureToTexture
@@ -2118,7 +2116,7 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice(
* provide SPIR-V shaders if applicable.
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`: The app is able to
* provide DXBC shaders if applicable
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to
* provide DXIL shaders if applicable.
* - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`: The app is able to
* provide MSL shaders if applicable.
@@ -2247,6 +2245,12 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
* - [[texture]]: Sampled textures, followed by read-only storage textures,
* followed by read-write storage textures
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the compute pipeline to
* create.
@@ -2262,9 +2266,17 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline
SDL_GPUDevice *device,
const SDL_GPUComputePipelineCreateInfo *createinfo);
#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING "SDL.gpu.computepipeline.create.name"
/**
* Creates a pipeline object to be used in a graphics workflow.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the graphics pipeline to
* create.
@@ -2281,10 +2293,18 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli
SDL_GPUDevice *device,
const SDL_GPUGraphicsPipelineCreateInfo *createinfo);
#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING "SDL.gpu.graphicspipeline.create.name"
/**
* Creates a sampler object to be used when binding textures in a graphics
* workflow.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed
* in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the sampler to create.
* \returns a sampler object on success, or NULL on failure; call
@@ -2300,6 +2320,8 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
SDL_GPUDevice *device,
const SDL_GPUSamplerCreateInfo *createinfo);
#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING "SDL.gpu.sampler.create.name"
/**
* Creates a shader to be used when creating a graphics pipeline.
*
@@ -2357,6 +2379,12 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
* SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with
* SDL_CreateGPUDeviceWithProperties().
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in
* debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the shader to create.
* \returns a shader object on success, or NULL on failure; call
@@ -2371,6 +2399,8 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
SDL_GPUDevice *device,
const SDL_GPUShaderCreateInfo *createinfo);
#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING "SDL.gpu.shader.create.name"
/**
* Creates a texture object to be used in graphics or compute workflows.
*
@@ -2387,27 +2417,26 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
* There are optional properties that can be provided through
* SDL_GPUTextureCreateInfo's `props`. These are the supported properties:
*
* - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing
* the program to run, any arguments, and a NULL pointer, e.g. const char
* *args[] = { "myprogram", "argument", NULL }. This is a required property.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this red intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this green intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this blue intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if
* the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
* to a color with this alpha intensity. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only)
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only)
* if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear
* the texture to a depth of this value. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
* - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
* only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET,
* clear the texture to a stencil of this value. Defaults to zero.
* - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed
* in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the texture to create.
@@ -2431,13 +2460,13 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
SDL_GPUDevice *device,
const SDL_GPUTextureCreateInfo *createinfo);
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT "SDL.gpu.createtexture.d3d12.clear.r"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT "SDL.gpu.createtexture.d3d12.clear.g"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT "SDL.gpu.createtexture.d3d12.clear.b"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT "SDL.gpu.texture.create.d3d12.clear.r"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT "SDL.gpu.texture.create.d3d12.clear.g"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT "SDL.gpu.texture.create.d3d12.clear.b"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT "SDL.gpu.texture.create.d3d12.clear.a"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.texture.create.d3d12.clear.depth"
#define SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.texture.create.d3d12.clear.stencil"
#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name"
/**
* Creates a buffer object to be used in graphics or compute workflows.
@@ -2453,6 +2482,12 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
* [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
* .
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in
* debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the buffer to create.
* \returns a buffer object on success, or NULL on failure; call
@@ -2460,7 +2495,6 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SetGPUBufferName
* \sa SDL_UploadToGPUBuffer
* \sa SDL_DownloadFromGPUBuffer
* \sa SDL_CopyGPUBufferToBuffer
@@ -2478,6 +2512,8 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
SDL_GPUDevice *device,
const SDL_GPUBufferCreateInfo *createinfo);
#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING "SDL.gpu.buffer.create.name"
/**
* Creates a transfer buffer to be used when uploading to or downloading from
* graphics resources.
@@ -2485,6 +2521,12 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
* Download buffers can be particularly expensive to create, so it is good
* practice to reuse them if data will be downloaded regularly.
*
* There are optional properties that can be provided through `props`. These
* are the supported properties:
*
* - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be
* displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the transfer buffer to
* create.
@@ -2503,18 +2545,26 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer(
SDL_GPUDevice *device,
const SDL_GPUTransferBufferCreateInfo *createinfo);
#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING "SDL.gpu.transferbuffer.create.name"
/* Debug Naming */
/**
* Sets an arbitrary string constant to label a buffer.
*
* Useful for debugging.
* You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with
* SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.
*
* \param device a GPU Context.
* \param buffer a buffer to attach the name to.
* \param text a UTF-8 string constant to mark as the name of the buffer.
*
* \threadsafety This function is not thread safe, you must make sure the
* buffer is not simultaneously used by any other thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateGPUBuffer
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
SDL_GPUDevice *device,
@@ -2524,13 +2574,20 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
/**
* Sets an arbitrary string constant to label a texture.
*
* Useful for debugging.
* You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with
* SDL_CreateGPUTexture instead of this function to avoid thread safety
* issues.
*
* \param device a GPU Context.
* \param texture a texture to attach the name to.
* \param text a UTF-8 string constant to mark as the name of the texture.
*
* \threadsafety This function is not thread safe, you must make sure the
* texture is not simultaneously used by any other thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CreateGPUTexture
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName(
SDL_GPUDevice *device,
@@ -3664,7 +3721,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUSwapchainParameters(
* \returns true if successful, false on error; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUAllowedFramesInFlight(
SDL_GPUDevice *device,
@@ -3749,7 +3806,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_AcquireGPUSwapchainTexture(
* \threadsafety This function should only be called from the thread that
* created the window.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_AcquireGPUSwapchainTexture
* \sa SDL_WaitAndAcquireGPUSwapchainTexture
@@ -3792,7 +3849,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WaitForGPUSwapchain(
* \threadsafety This function should only be called from the thread that
* created the window.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SubmitGPUCommandBuffer
* \sa SDL_SubmitGPUCommandBufferAndAcquireFence
+52 -1
View File
@@ -2534,7 +2534,7 @@ extern "C" {
* - "1": Relative mouse motion will be scaled using the system mouse
* acceleration curve.
*
* If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will override the
* If SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE is set, that will be applied after
* system speed scale.
*
* This hint can be set anytime.
@@ -3330,6 +3330,27 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES "SDL_VIDEO_MAC_FULLSCREEN_SPACES"
/**
* A variable that specifies the menu visibility when a window is fullscreen
* in Spaces on macOS.
*
* The variable can be set to the following values:
*
* - "0": The menu will be hidden when the window is in a fullscreen space,
* and not accessible by moving the mouse to the top of the screen.
* - "1": The menu will be accessible when the window is in a fullscreen
* space.
* - "auto": The menu will be hidden if fullscreen mode was toggled on
* programmatically via `SDL_SetWindowFullscreen()`, and accessible if
* fullscreen was entered via the "fullscreen" button on the window title
* bar. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.1.9.
*/
#define SDL_HINT_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY "SDL_VIDEO_MAC_FULLSCREEN_MENU_VISIBILITY"
/**
* A variable controlling whether fullscreen windows are minimized when they
* lose focus.
@@ -4164,6 +4185,36 @@ extern "C" {
*/
#define SDL_HINT_ASSERT "SDL_ASSERT"
/**
* A variable controlling whether pen events should generate synthetic mouse
* events.
*
* The variable can be set to the following values:
*
* - "0": Pen events will not generate mouse events.
* - "1": Pen events will generate mouse events. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.2.0.
*/
#define SDL_HINT_PEN_MOUSE_EVENTS "SDL_PEN_MOUSE_EVENTS"
/**
* A variable controlling whether pen events should generate synthetic touch
* events.
*
* The variable can be set to the following values:
*
* - "0": Pen events will not generate touch events.
* - "1": Pen events will generate touch events. (default)
*
* This hint can be set anytime.
*
* \since This hint is available since SDL 3.2.0.
*/
#define SDL_HINT_PEN_TOUCH_EVENTS "SDL_PEN_TOUCH_EVENTS"
/**
* An enumeration of hint priorities.
+2 -2
View File
@@ -313,7 +313,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RunOnMainThread
*/
@@ -350,7 +350,7 @@ typedef void (SDLCALL *SDL_MainThreadCallback)(void *userdata);
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_IsMainThread
*/
+98 -5
View File
@@ -260,6 +260,8 @@ typedef struct SDL_IOStream SDL_IOStream;
* \returns a pointer to the SDL_IOStream structure that is created or NULL on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CloseIO
@@ -303,6 +305,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons
* \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOFromConstMem
@@ -347,6 +351,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size)
* \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOFromMem
@@ -375,6 +381,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromConstMem(const void *mem, s
* \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
* SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CloseIO
@@ -408,6 +416,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void);
* \returns a pointer to the allocated memory on success or NULL on failure;
* call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_CloseIO
@@ -442,6 +452,8 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_OpenIO
@@ -455,6 +467,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context);
* \returns a valid property ID on success or 0 on failure; call
* SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *context);
@@ -473,8 +487,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetIOProperties(SDL_IOStream *c
* \param context the SDL_IOStream to query.
* \returns an SDL_IOStatus enum with the current state.
*
* \threadsafety This function should not be called at the same time that
* another thread is operating on the same SDL_IOStream.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
@@ -488,6 +501,8 @@ extern SDL_DECLSPEC SDL_IOStatus SDLCALL SDL_GetIOStatus(SDL_IOStream *context);
* negative error code on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context);
@@ -513,6 +528,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context);
* \returns the final offset in the data stream after the seek or -1 on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_TellIO
@@ -531,6 +548,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_SeekIO(SDL_IOStream *context, Sint64 offs
* \returns the current offset in the stream, or -1 if the information can not
* be determined.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_SeekIO
@@ -554,6 +573,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_TellIO(SDL_IOStream *context);
* \returns the number of bytes read, or 0 on end of file or other failure;
* call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_WriteIO
@@ -581,6 +602,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr,
* \returns the number of bytes written, which will be less than `size` on
* failure; call SDL_GetError() for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOprintf
@@ -603,6 +626,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void
* \returns the number of bytes written or 0 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOvprintf
@@ -621,6 +646,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT
* \returns the number of bytes written or 0 on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_IOprintf
@@ -639,6 +666,8 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_OpenIO
@@ -663,6 +692,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context);
* \returns the data or NULL on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_LoadFile
@@ -684,6 +715,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *da
* \returns the data or NULL on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*
* \sa SDL_LoadFile_IO
@@ -703,7 +736,9 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SaveFile
* \sa SDL_LoadFile_IO
@@ -713,14 +748,16 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile_IO(SDL_IOStream *src, const void *
/**
* Save all the data into a file path.
*
* \param file the path to read all available data from.
* \param file the path to write all available data into.
* \param data the data to be written. If datasize is 0, may be NULL or a
* invalid pointer.
* \param datasize the number of bytes to be written.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 3.2.0.
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_SaveFile_IO
* \sa SDL_LoadFile
@@ -747,6 +784,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data
* \returns true on success or false on failure or EOF; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
@@ -764,6 +803,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value);
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
@@ -785,6 +826,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value);
@@ -806,6 +849,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value);
@@ -827,6 +872,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value);
@@ -848,6 +895,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value);
@@ -869,6 +918,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value);
@@ -890,6 +941,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value);
@@ -911,6 +964,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value);
@@ -932,6 +987,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value);
@@ -953,6 +1010,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value);
@@ -974,6 +1033,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value);
@@ -995,6 +1056,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value);
@@ -1016,6 +1079,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value);
@@ -1036,6 +1101,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
@@ -1048,6 +1115,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value);
@@ -1065,6 +1134,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value);
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value);
@@ -1082,6 +1153,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value);
@@ -1098,6 +1171,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value);
@@ -1114,6 +1189,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value);
@@ -1131,6 +1208,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value);
@@ -1148,6 +1227,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value);
@@ -1164,6 +1245,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value);
@@ -1180,6 +1263,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value);
@@ -1197,6 +1282,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value);
@@ -1214,6 +1301,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value);
@@ -1230,6 +1319,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value);
@@ -1246,6 +1337,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value)
* \returns true on successful write or false on failure; call SDL_GetError()
* for more information.
*
* \threadsafety This function is not thread safe.
*
* \since This function is available since SDL 3.1.3.
*/
extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value);
+13 -1
View File
@@ -47,11 +47,15 @@
* A special exception is the number keys at the top of the keyboard which map
* to SDLK_0...SDLK_9 on AZERTY layouts.
*
* Keys with the `SDLK_EXTENDED_MASK` bit set do not map to a scancode or
* unicode code point.
*
* \since This datatype is available since SDL 3.1.3.
*/
typedef Uint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1u<<30)
#define SDLK_EXTENDED_MASK (1u << 29)
#define SDLK_SCANCODE_MASK (1u << 30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
#define SDLK_UNKNOWN 0x00000000u /**< 0 */
#define SDLK_RETURN 0x0000000du /**< '\r' */
@@ -302,6 +306,13 @@ typedef Uint32 SDL_Keycode;
#define SDLK_SOFTRIGHT 0x40000120u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT) */
#define SDLK_CALL 0x40000121u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL) */
#define SDLK_ENDCALL 0x40000122u /**< SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_ENDCALL) */
#define SDLK_LEFT_TAB 0x20000001u /**< Extended key Left Tab */
#define SDLK_LEVEL5_SHIFT 0x20000002u /**< Extended key Level 5 Shift */
#define SDLK_MULTI_KEY_COMPOSE 0x20000003u /**< Extended key Multi-key Compose */
#define SDLK_LMETA 0x20000004u /**< Extended key Left Meta */
#define SDLK_RMETA 0x20000005u /**< Extended key Right Meta */
#define SDLK_LHYPER 0x20000006u /**< Extended key Left Hyper */
#define SDLK_RHYPER 0x20000007u /**< Extended key Right Hyper */
/**
* Valid key modifiers (possibly OR'd together).
@@ -313,6 +324,7 @@ typedef Uint16 SDL_Keymod;
#define SDL_KMOD_NONE 0x0000u /**< no modifier is applicable. */
#define SDL_KMOD_LSHIFT 0x0001u /**< the left Shift key is down. */
#define SDL_KMOD_RSHIFT 0x0002u /**< the right Shift key is down. */
#define SDL_KMOD_LEVEL5 0x0004u /**< the Level 5 Shift key is down. */
#define SDL_KMOD_LCTRL 0x0040u /**< the left Ctrl (Control) key is down. */
#define SDL_KMOD_RCTRL 0x0080u /**< the right Ctrl (Control) key is down. */
#define SDL_KMOD_LALT 0x0100u /**< the left Alt key is down. */
+12 -1
View File
@@ -22,7 +22,18 @@
/**
* # CategoryMessagebox
*
* Message box support routines.
* SDL offers a simple message box API, which is useful for simple alerts,
* such as informing the user when something fatal happens at startup without
* the need to build a UI for it (or informing the user _before_ your UI is
* ready).
*
* These message boxes are native system dialogs where possible.
*
* There is both a customizable function (SDL_ShowMessageBox()) that offers
* lots of options for what to display and reports on what choice the user
* made, and also a much-simplified version (SDL_ShowSimpleMessageBox()),
* merely takes a text message and title, and waits until the user presses a
* single "OK" UI button. Often, this is all that is necessary.
*/
#ifndef SDL_messagebox_h_
+5
View File
@@ -359,6 +359,11 @@ extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y);
* report continuous relative mouse motion even if the mouse is at the edge of
* the window.
*
* If you'd like to keep the mouse position fixed while in relative mode you
* can use SDL_SetWindowMouseRect(). If you'd like the cursor to be at a
* specific location when relative mode ends, you should use
* SDL_WarpMouseInWindow() before disabling relative mode.
*
* This function will flush any pending mouse motion for this window.
*
* \param window the window to change.
+1 -1
View File
@@ -963,7 +963,7 @@ typedef enum SDL_InitStatus
* {
* if (!SDL_ShouldQuit(&init)) {
* // The system is not initialized
* return true;
* return;
* }
*
* // At this point, you should not leave this function without calling SDL_SetInitialized()
+16
View File
@@ -40,6 +40,8 @@
#define SDL_pen_h_
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_mouse.h>
#include <SDL3/SDL_touch.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@@ -59,6 +61,20 @@ extern "C" {
*/
typedef Uint32 SDL_PenID;
/**
* The SDL_MouseID for mouse events simulated with pen input.
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_PEN_MOUSEID ((SDL_MouseID)-2)
/**
* The SDL_TouchID for touch events simulated with pen input.
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_PEN_TOUCHID ((SDL_TouchID)-2)
/**
* Pen input flags, as reported by various pen events' `pen_state` field.
+4 -4
View File
@@ -1273,8 +1273,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
* `SDL_TEXTUREACCESS_STREAMING`.
* \param rect a pointer to the rectangle to lock for access. If the rect is
* NULL, the entire texture will be locked.
* \param surface this is filled in with an SDL surface representing the
* locked area.
* \param surface a pointer to an SDL surface of size **rect**. Don't assume
* any specific pixel content.
* \returns true on success or false on failure; call SDL_GetError() for more
* information.
*
@@ -2110,7 +2110,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer
*
* \threadsafety You may only call this function from the main thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RenderTexture
*/
@@ -2568,7 +2568,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, flo
*
* \threadsafety This function should only be called on the main thread.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RenderDebugText
* \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
+36
View File
@@ -107,6 +107,32 @@ void *alloca(size_t);
# endif
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
* Don't let SDL use "long long" C types.
*
* SDL will define this if it believes the compiler doesn't understand the
* "long long" syntax for C datatypes. This can happen on older compilers.
*
* If _your_ compiler doesn't support "long long" but SDL doesn't know it, it
* is safe to define this yourself to build against the SDL headers.
*
* If this is defined, it will remove access to some C runtime support
* functions, like SDL_ulltoa and SDL_strtoll that refer to this datatype
* explicitly. The rest of SDL will still be available.
*
* SDL's own source code cannot be built with a compiler that has this
* defined, for various technical reasons.
*/
#define SDL_NOLONGLONG 1
#elif defined(_MSC_VER) && (_MSC_VER < 1310) /* long long introduced in Visual Studio.NET 2003 */
# define SDL_NOLONGLONG 1
#endif
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
@@ -753,7 +779,9 @@ typedef Sint64 SDL_Time;
#endif
/* Specifically for the `long long` -- SDL-specific. */
#ifdef SDL_PLATFORM_WINDOWS
#ifndef SDL_NOLONGLONG
SDL_COMPILE_TIME_ASSERT(longlong_size64, sizeof(long long) == 8); /* using I64 for windows - make sure `long long` is 64 bits. */
#endif
#define SDL_PRILL_PREFIX "I64"
#else
#define SDL_PRILL_PREFIX "ll"
@@ -1126,8 +1154,10 @@ SDL_COMPILE_TIME_ASSERT(uint32_size, sizeof(Uint32) == 4);
SDL_COMPILE_TIME_ASSERT(sint32_size, sizeof(Sint32) == 4);
SDL_COMPILE_TIME_ASSERT(uint64_size, sizeof(Uint64) == 8);
SDL_COMPILE_TIME_ASSERT(sint64_size, sizeof(Sint64) == 8);
#ifndef SDL_NOLONGLONG
SDL_COMPILE_TIME_ASSERT(uint64_longlong, sizeof(Uint64) <= sizeof(unsigned long long));
SDL_COMPILE_TIME_ASSERT(size_t_longlong, sizeof(size_t) <= sizeof(unsigned long long));
#endif
typedef struct SDL_alignment_test
{
Uint8 a;
@@ -3492,6 +3522,8 @@ extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix);
*/
extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int radix);
#ifndef SDL_NOLONGLONG
/**
* Convert a long long integer into a string.
*
@@ -3547,6 +3579,7 @@ extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int rad
* \sa SDL_ultoa
*/
extern SDL_DECLSPEC char * SDLCALL SDL_ulltoa(unsigned long long value, char *str, int radix);
#endif
/**
* Parse an `int` from a string.
@@ -3660,6 +3693,8 @@ extern SDL_DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int ba
*/
extern SDL_DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base);
#ifndef SDL_NOLONGLONG
/**
* Parse a `long long` from a string.
*
@@ -3726,6 +3761,7 @@ extern SDL_DECLSPEC long long SDLCALL SDL_strtoll(const char *str, char **endp,
* \sa SDL_ulltoa
*/
extern SDL_DECLSPEC unsigned long long SDLCALL SDL_strtoull(const char *str, char **endp, int base);
#endif
/**
* Parse a `double` from a string.
+20 -4
View File
@@ -47,7 +47,7 @@
*
* Consider the following example:
*
* ```
* ```c
* void ReadGameData(void)
* {
* extern char** fileNames;
@@ -112,10 +112,10 @@
* validated, so an error occurring elsewhere in the program may result in
* missing/corrupted save data
*
* When using, SDL_Storage, these types of problems are virtually impossible
* to trip over:
* When using SDL_Storage, these types of problems are virtually impossible to
* trip over:
*
* ```
* ```c
* void ReadGameData(void)
* {
* extern char** fileNames;
@@ -222,6 +222,22 @@
* playing on another PC (and vice versa) with the save data fully
* synchronized across all devices, allowing for a seamless experience without
* having to do full restarts of the program.
*
* ## Notes on valid paths
*
* All paths in the Storage API use Unix-style path separators ('/'). Using a
* different path separator will not work, even if the underlying platform
* would otherwise accept it. This is to keep code using the Storage API
* portable between platforms and Storage implementations and simplify app
* code.
*
* Paths with relative directories ("." and "..") are forbidden by the Storage
* API.
*
* All valid UTF-8 strings (discounting the NULL terminator character and the
* '/' path separator) are usable for filenames, however, an underlying
* Storage implementation may not support particularly strange sequences and
* refuse to create files with those names, etc.
*/
#ifndef SDL_storage_h_
+1
View File
@@ -139,6 +139,7 @@ typedef struct
int gl_accum_blue_size;
int gl_accum_alpha_size;
int gl_stereo;
int gl_release_behavior;
int gl_multisamplebuffers;
int gl_multisamplesamples;
int gl_retained_backing;
+1 -1
View File
@@ -446,7 +446,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status)
* \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread
* isn't valid.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_ThreadState
*/
+35 -28
View File
@@ -106,7 +106,7 @@ typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry);
* UTF-8 encoding. Not supported on all platforms. May be NULL.
* \returns The newly created system tray icon.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenu
@@ -120,7 +120,7 @@ extern SDL_DECLSPEC SDL_Tray *SDLCALL SDL_CreateTray(SDL_Surface *icon, const ch
* \param tray the tray icon to be updated.
* \param icon the new icon. May be NULL.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
@@ -132,7 +132,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *ic
* \param tray the tray icon to be updated.
* \param tooltip the new tooltip in UTF-8 encoding. May be NULL.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
@@ -151,7 +151,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayTooltip(SDL_Tray *tray, const char *
* \param tray the tray to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
* \sa SDL_GetTrayMenu
@@ -172,7 +172,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTrayMenu(SDL_Tray *tray);
* \param entry the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
* \sa SDL_GetTraySubmenu
@@ -194,7 +194,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_CreateTraySubmenu(SDL_TrayEntry *e
* \param tray the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
* \sa SDL_CreateTrayMenu
@@ -204,7 +204,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray);
/**
* Gets a previously created tray entry submenu.
*
* You should have called SDL_CreateTraySubenu() on the entry object. This
* You should have called SDL_CreateTraySubmenu() on the entry object. This
* function allows you to fetch it again later.
*
* This function does the same thing as SDL_GetTrayMenu(), except that it
@@ -215,7 +215,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayMenu(SDL_Tray *tray);
* \param entry the tray entry to bind the menu to.
* \returns the newly created menu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
* \sa SDL_CreateTraySubmenu
@@ -232,7 +232,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTraySubmenu(SDL_TrayEntry *entr
* pointer becomes invalid when any function that inserts or deletes
* entries in the menu is called.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_RemoveTrayEntry
* \sa SDL_InsertTrayEntryAt
@@ -244,7 +244,7 @@ extern SDL_DECLSPEC const SDL_TrayEntry **SDLCALL SDL_GetTrayEntries(SDL_TrayMen
*
* \param entry The entry to be deleted.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -267,7 +267,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveTrayEntry(SDL_TrayEntry *entry);
* \param flags a combination of flags, some of which are mandatory.
* \returns the newly created entry, or NULL if pos is out of bounds.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_TrayEntryFlags
* \sa SDL_GetTrayEntries
@@ -287,7 +287,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_InsertTrayEntryAt(SDL_TrayMenu *m
* \param entry the entry to be updated.
* \param label the new label for the entry in UTF-8 encoding.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -303,7 +303,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, con
* \param entry the entry to be read.
* \returns the label of the entry in UTF-8 encoding.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -317,10 +317,9 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetTrayEntryLabel(SDL_TrayEntry *ent
* The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
*
* \param entry the entry to be updated.
* \param checked SDL_TRUE if the entry should be checked; SDL_FALSE
* otherwise.
* \param checked true if the entry should be checked; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -334,9 +333,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, b
* The entry must have been created with the SDL_TRAYENTRY_CHECKBOX flag.
*
* \param entry the entry to be read.
* \returns SDL_TRUE if the entry is checked; SDL_FALSE otherwise.
* \returns true if the entry is checked; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -348,10 +347,9 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry);
* Sets whether or not an entry is enabled.
*
* \param entry the entry to be updated.
* \param enabled SDL_TRUE if the entry should be enabled; SDL_FALSE
* otherwise.
* \param enabled true if the entry should be enabled; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -363,9 +361,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, b
* Gets whether or not an entry is enabled.
*
* \param entry the entry to be read.
* \returns SDL_TRUE if the entry is enabled; SDL_FALSE otherwise.
* \returns true if the entry is enabled; false otherwise.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
@@ -381,13 +379,22 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry);
* \param userdata an optional pointer to pass extra data to the callback when
* it will be invoked.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_GetTrayEntries
* \sa SDL_InsertTrayEntryAt
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata);
/**
* Simulate a click on a tray entry.
*
* \param entry The entry to activate.
*
* \since This function is available since SDL 3.2.0.
*/
extern SDL_DECLSPEC void SDLCALL SDL_ClickTrayEntry(SDL_TrayEntry *entry);
/**
* Destroys a tray object.
*
@@ -395,7 +402,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryCallback(SDL_TrayEntry *entry,
*
* \param tray the tray icon to be destroyed.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTray
*/
@@ -407,7 +414,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTray(SDL_Tray *tray);
* \param entry the entry for which to get the parent menu.
* \returns the parent menu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_InsertTrayEntryAt
*/
@@ -423,7 +430,7 @@ extern SDL_DECLSPEC SDL_TrayMenu *SDLCALL SDL_GetTrayEntryParent(SDL_TrayEntry *
* \param menu the menu for which to get the parent entry.
* \returns the parent entry, or NULL if this menu is not a submenu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTraySubmenu
* \sa SDL_GetTrayMenuParentTray
@@ -440,7 +447,7 @@ extern SDL_DECLSPEC SDL_TrayEntry *SDLCALL SDL_GetTrayMenuParentEntry(SDL_TrayMe
* \param menu the menu for which to get the parent enttrayry.
* \returns the parent tray, or NULL if this menu is a submenu.
*
* \since This function is available since SDL 3.2.0.
* \since This function is available since SDL 3.1.8.
*
* \sa SDL_CreateTrayMenu
* \sa SDL_GetTrayMenuParentEntry
+1 -1
View File
@@ -62,7 +62,7 @@ extern "C" {
*
* \since This macro is available since SDL 3.1.3.
*/
#define SDL_MICRO_VERSION 8
#define SDL_MICRO_VERSION 10
/**
* This macro turns the version numbers into a numeric value.
+1 -1
View File
@@ -55,7 +55,7 @@
#include "video/SDL_surface_c.h"
#include "video/SDL_video_c.h"
#include "filesystem/SDL_filesystem_c.h"
#include "file/SDL_asyncio_c.h"
#include "io/SDL_asyncio_c.h"
#ifdef SDL_PLATFORM_ANDROID
#include "core/android/SDL_android.h"
#endif
+15
View File
@@ -78,7 +78,18 @@
#ifndef _DARWIN_C_SOURCE
#define _DARWIN_C_SOURCE 1 // for memset_pattern4()
#endif
#include <Availability.h>
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
#define __IPHONE_OS_VERSION_MAX_ALLOWED 0
#endif
#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED
#define __APPLETV_OS_VERSION_MAX_ALLOWED 0
#endif
#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
#define __MAC_OS_X_VERSION_MAX_ALLOWED 0
#endif
#endif // SDL_PLATFORM_APPLE
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -217,6 +228,10 @@
#define SDL_EndThreadFunction NULL
#endif
#ifdef SDL_NOLONGLONG
#error We cannot build a valid SDL3 library without long long support
#endif
/* Enable internal definitions in SDL API headers */
#define SDL_INTERNAL
+45 -3
View File
@@ -281,6 +281,18 @@ bool SDL_AudioSpecsEqual(const SDL_AudioSpec *a, const SDL_AudioSpec *b, const i
return true;
}
bool SDL_AudioChannelMapsEqual(int channels, const int *channel_map_a, const int *channel_map_b)
{
if (channel_map_a == channel_map_b) {
return true;
} else if ((channel_map_a != NULL) != (channel_map_b != NULL)) {
return false;
} else if (channel_map_a && (SDL_memcmp(channel_map_a, channel_map_b, sizeof (*channel_map_a) * channels) != 0)) {
return false;
}
return true;
}
// Zombie device implementation...
@@ -1134,7 +1146,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
SDL_AudioStream *stream = logdev->bound_streams;
// We should have updated this elsewhere if the format changed!
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, stream->dst_chmap, device->chmap));
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, NULL, NULL));
const int br = SDL_GetAtomicInt(&logdev->paused) ? 0 : SDL_GetAudioStreamDataAdjustGain(stream, device_buffer, buffer_size, logdev->gain);
if (br < 0) { // Probably OOM. Kill the audio device; the whole thing is likely dying soon anyhow.
@@ -1143,6 +1155,12 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
} else if (br < buffer_size) {
SDL_memset(device_buffer + br, device->silence_value, buffer_size - br); // silence whatever we didn't write to.
}
// generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to device layout.
if ((br > 0) && (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->dst_chmap, device->chmap))) {
ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), device_buffer, device->spec.format, device->spec.channels, NULL,
device_buffer, device->spec.format, device->spec.channels, device->chmap, NULL, 1.0f);
}
} else { // need to actually mix (or silence the buffer)
float *final_mix_buffer = (float *) ((device->spec.format == SDL_AUDIO_F32) ? device_buffer : device->mix_buffer);
const int needed_samples = buffer_size / SDL_AUDIO_BYTESIZE(device->spec.format);
@@ -1170,7 +1188,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
for (SDL_AudioStream *stream = logdev->bound_streams; stream; stream = stream->next_binding) {
// We should have updated this elsewhere if the format changed!
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &outspec, stream->dst_chmap, device->chmap));
SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &outspec, NULL, NULL));
/* this will hold a lock on `stream` while getting. We don't explicitly lock the streams
for iterating here because the binding linked list can only change while the device lock is held.
@@ -1181,6 +1199,11 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device)
failed = true;
break;
} else if (br > 0) { // it's okay if we get less than requested, we mix what we have.
// generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to device layout.
if (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->dst_chmap, device->chmap)) {
ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), device->work_buffer, device->spec.format, device->spec.channels, NULL,
device->work_buffer, device->spec.format, device->spec.channels, device->chmap, NULL, 1.0f);
}
MixFloat32Audio(mix_buffer, (float *) device->work_buffer, br);
}
}
@@ -1303,11 +1326,20 @@ bool SDL_RecordingAudioThreadIterate(SDL_AudioDevice *device)
SDL_assert(stream->src_spec.channels == device->spec.channels);
SDL_assert(stream->src_spec.freq == device->spec.freq);
void *final_buf = output_buffer;
// generally channel maps will line up, but if the audio stream's chmap has been explicitly changed, do a final swizzle to stream layout.
if (!SDL_AudioChannelMapsEqual(device->spec.channels, stream->src_chmap, device->chmap)) {
final_buf = device->mix_buffer; // this is otherwise unused on recording devices, so it makes convenient scratch space here.
ConvertAudio(br / SDL_AUDIO_FRAMESIZE(device->spec), output_buffer, device->spec.format, device->spec.channels, NULL,
final_buf, device->spec.format, device->spec.channels, stream->src_chmap, NULL, 1.0f);
}
/* this will hold a lock on `stream` while putting. We don't explicitly lock the streams
for iterating here because the binding linked list can only change while the device lock is held.
(we _do_ lock the stream during binding/unbinding to make sure that two threads can't try to bind
the same stream to different devices at the same time, though.) */
if (!SDL_PutAudioStreamData(stream, output_buffer, br)) {
if (!SDL_PutAudioStreamData(stream, final_buf, br)) {
// oh crud, we probably ran out of memory. This is possibly an overreaction to kill the audio device, but it's likely the whole thing is going down in a moment anyhow.
failed = true;
break;
@@ -2130,6 +2162,16 @@ bool SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream)
return SDL_ResumeAudioDevice(devid);
}
bool SDL_AudioStreamDevicePaused(SDL_AudioStream *stream)
{
SDL_AudioDeviceID devid = SDL_GetAudioStreamDevice(stream);
if (!devid) {
return false;
}
return SDL_AudioDevicePaused(devid);
}
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define NATIVE(type) SDL_AUDIO_##type##LE
#define SWAPPED(type) SDL_AUDIO_##type##BE
+8 -5
View File
@@ -154,7 +154,7 @@ static void SwizzleAudio(const int num_frames, void *dst, const void *src, int c
{
const int bitsize = (int) SDL_AUDIO_BITSIZE(fmt);
bool has_null_mappings = false;
bool has_null_mappings = false; // !!! FIXME: calculate this when setting the channel map instead.
for (int i = 0; i < channels; i++) {
if (map[i] == -1) {
has_null_mappings = true;
@@ -257,6 +257,11 @@ void ConvertAudio(int num_frames,
const int dst_bitsize = (int) SDL_AUDIO_BITSIZE(dst_format);
const int dst_sample_frame_size = (dst_bitsize / 8) * dst_channels;
const bool chmaps_match = (src_channels == dst_channels) && SDL_AudioChannelMapsEqual(src_channels, src_map, dst_map);
if (chmaps_match) {
src_map = dst_map = NULL; // NULL both these out so we don't do any unnecessary swizzling.
}
/* Type conversion goes like this now:
- swizzle through source channel map to "standard" layout.
- byteswap to CPU native format first if necessary.
@@ -635,8 +640,6 @@ bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec
// already have this map, don't allocate/copy it again.
} else if (SDL_ChannelMapIsBogus(chmap, channels)) {
result = SDL_SetError("Invalid channel mapping");
} else if ((isinput != -1) && stream->bound_device && (!!isinput == !!stream->bound_device->physical_device->recording)) {
// quietly refuse to change the format of the end currently bound to a device.
} else {
if (SDL_ChannelMapIsDefault(chmap, channels)) {
chmap = NULL; // just apply a default mapping.
@@ -661,12 +664,12 @@ bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec
bool SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels)
{
return SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, chmap, channels, true);
return SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, chmap, channels, 1);
}
bool SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels)
{
return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, false);
return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, 0);
}
int *SDL_GetAudioStreamInputChannelMap(SDL_AudioStream *stream, int *count)
+5 -1
View File
@@ -125,9 +125,13 @@ extern void ConvertAudio(int num_frames,
// Compare two SDL_AudioSpecs, return true if they match exactly.
// Using SDL_memcmp directly isn't safe, since potential padding might not be initialized.
// either channel maps can be NULL for the default (and both should be if you don't care about them).
// either channel map can be NULL for the default (and both should be if you don't care about them).
extern bool SDL_AudioSpecsEqual(const SDL_AudioSpec *a, const SDL_AudioSpec *b, const int *channel_map_a, const int *channel_map_b);
// See if two channel maps match
// either channel map can be NULL for the default (and both should be if you don't care about them).
extern bool SDL_AudioChannelMapsEqual(int channels, const int *channel_map_a, const int *channel_map_b);
// allocate+copy a channel map.
extern int *SDL_ChannelMapDup(const int *origchmap, int channels);
+41 -28
View File
@@ -467,31 +467,16 @@ static bool UpdateAudioSession(SDL_AudioDevice *device, bool open, bool allow_pl
options |= AVAudioSessionCategoryOptionDuckOthers;
}
if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) {
if (![session.category isEqualToString:category] || session.categoryOptions != options) {
// Stop the current session so we don't interrupt other application audio
PauseAudioDevices();
[session setActive:NO error:nil];
session_active = false;
if (![session.category isEqualToString:category] || session.categoryOptions != options) {
// Stop the current session so we don't interrupt other application audio
PauseAudioDevices();
[session setActive:NO error:nil];
session_active = false;
if (![session setCategory:category mode:mode options:options error:&err]) {
NSString *desc = err.description;
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
return false;
}
}
} else {
if (![session.category isEqualToString:category]) {
// Stop the current session so we don't interrupt other application audio
PauseAudioDevices();
[session setActive:NO error:nil];
session_active = false;
if (![session setCategory:category error:&err]) {
NSString *desc = err.description;
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
return false;
}
if (![session setCategory:category mode:mode options:options error:&err]) {
NSString *desc = err.description;
SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
return false;
}
}
@@ -780,12 +765,40 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
layout.mChannelLayoutTag = kAudioChannelLayoutTag_DVD_12;
break;
case 7:
// L R C LFE Cs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
// L R C LFE Cs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_6_1;
} else {
// L R C LFE Ls Rs Cs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_6_1_A;
// Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_6_1_A
static const int swizzle_map[7] = {
0, 1, 2, 3, 6, 4, 5
};
device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map));
if (!device->chmap) {
return false;
}
}
break;
case 8:
// L R C LFE Rls Rrs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) {
// L R C LFE Rls Rrs Ls Rs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_WAVE_7_1;
} else {
// L R C LFE Ls Rs Rls Rrs
layout.mChannelLayoutTag = kAudioChannelLayoutTag_MPEG_7_1_C;
// Convert from SDL channel layout to kAudioChannelLayoutTag_MPEG_7_1_C
static const int swizzle_map[8] = {
0, 1, 2, 3, 6, 7, 4, 5
};
device->chmap = SDL_ChannelMapDup(swizzle_map, SDL_arraysize(swizzle_map));
if (!device->chmap) {
return false;
}
}
break;
default:
return SDL_SetError("Unsupported audio channels");
+1 -1
View File
@@ -190,7 +190,7 @@ static bool EMSCRIPTENAUDIO_OpenDevice(SDL_AudioDevice *device)
// limit to native freq
device->spec.freq = EM_ASM_INT({ return Module['SDL3'].audioContext.sampleRate; });
device->sample_frames = SDL_GetDefaultSampleFramesFromFreq(device->spec.freq);
device->sample_frames = SDL_GetDefaultSampleFramesFromFreq(device->spec.freq) * 2; // double the buffer size, some browsers need more, and we'll just have to live with the latency.
SDL_UpdatedAudioDeviceFormat(device);
+8 -15
View File
@@ -359,21 +359,14 @@ static struct sdl_video_format {
SDL_Colorspace colorspace;
uint32_t id;
} sdl_video_formats[] = {
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
{ SDL_PIXELFORMAT_RGBX8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGBx },
{ SDL_PIXELFORMAT_BGRX8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGRx },
{ SDL_PIXELFORMAT_RGBA8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGBA },
{ SDL_PIXELFORMAT_ARGB8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ARGB },
{ SDL_PIXELFORMAT_BGRA8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGRA },
{ SDL_PIXELFORMAT_ABGR8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ABGR },
#else
{ SDL_PIXELFORMAT_RGBX8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_xBGR },
{ SDL_PIXELFORMAT_BGRX8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_xRGB },
{ SDL_PIXELFORMAT_RGBA8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ABGR },
{ SDL_PIXELFORMAT_ARGB8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGRA },
{ SDL_PIXELFORMAT_BGRA8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ARGB },
{ SDL_PIXELFORMAT_ABGR8888, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGBA },
#endif
{ SDL_PIXELFORMAT_RGBX32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGBx },
{ SDL_PIXELFORMAT_XRGB32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_xRGB },
{ SDL_PIXELFORMAT_BGRX32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGRx },
{ SDL_PIXELFORMAT_XBGR32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_xBGR },
{ SDL_PIXELFORMAT_RGBA32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGBA },
{ SDL_PIXELFORMAT_ARGB32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ARGB },
{ SDL_PIXELFORMAT_BGRA32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGRA },
{ SDL_PIXELFORMAT_ABGR32, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_ABGR },
{ SDL_PIXELFORMAT_RGB24, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_RGB },
{ SDL_PIXELFORMAT_BGR24, SDL_COLORSPACE_SRGB, SPA_VIDEO_FORMAT_BGR },
{ SDL_PIXELFORMAT_YV12, SDL_COLORSPACE_BT709_LIMITED, SPA_VIDEO_FORMAT_YV12 },
+2 -18
View File
@@ -404,9 +404,6 @@ static void Internal_Android_Destroy_AssetManager(void);
static AAssetManager *asset_manager = NULL;
static jobject javaAssetManagerRef = 0;
// Re-create activity hint
static SDL_AtomicInt bAllowRecreateActivity;
static SDL_Mutex *Android_ActivityMutex = NULL;
static SDL_Mutex *Android_LifecycleMutex = NULL;
static SDL_Semaphore *Android_LifecycleEventSem = NULL;
@@ -564,7 +561,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab));
register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab));
register_methods(env, "org/libsdl/app/HIDDeviceManager", HIDDeviceManager_tab, SDL_arraysize(HIDDeviceManager_tab));
SDL_SetAtomicInt(&bAllowRecreateActivity, false);
return JNI_VERSION_1_4;
}
@@ -764,28 +760,16 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter)(
return tmp;
}
static void SDLCALL SDL_AllowRecreateActivityChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
{
if (SDL_GetStringBoolean(hint, false)) {
SDL_SetAtomicInt(&bAllowRecreateActivity, true);
} else {
SDL_SetAtomicInt(&bAllowRecreateActivity, false);
}
}
JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)(
JNIEnv *env, jclass jcls)
{
return SDL_GetAtomicInt(&bAllowRecreateActivity);
return SDL_GetHintBoolean(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, false);
}
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)(
JNIEnv *env, jclass jcls)
{
__android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeInitSDLThread() %d time", run_count);
if (run_count == 1) {
SDL_AddHintCallback(SDL_HINT_ANDROID_ALLOW_RECREATE_ACTIVITY, SDL_AllowRecreateActivityChanged, NULL);
}
run_count += 1;
// Save JNIEnv of SDLThread
@@ -899,7 +883,7 @@ static int FindLifecycleEvent(SDL_AndroidLifecycleEvent event)
static void RemoveLifecycleEvent(int index)
{
if (index < Android_NumLifecycleEvents - 1) {
SDL_memcpy(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index]));
SDL_memmove(&Android_LifecycleEvents[index], &Android_LifecycleEvents[index+1], (Android_NumLifecycleEvents - index - 1) * sizeof(Android_LifecycleEvents[index]));
}
--Android_NumLifecycleEvents;
}
+4 -4
View File
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,1,8,0
PRODUCTVERSION 3,1,8,0
FILEVERSION 3,1,10,0
PRODUCTVERSION 3,1,10,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
@@ -23,12 +23,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "3, 1, 8, 0\0"
VALUE "FileVersion", "3, 1, 10, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright (C) 2025 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL3.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "3, 1, 8, 0\0"
VALUE "ProductVersion", "3, 1, 10, 0\0"
END
END
BLOCK "VarFileInfo"
+2 -4
View File
@@ -146,8 +146,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
if (w) {
// [dialog beginWithCompletionHandler:^(NSInteger result) {
[dialog beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
// NSModalResponseOK for >= 10.13
if (result == NSFileHandlingPanelOKButton) {
if (result == NSModalResponseOK) {
if (dialog_as_open) {
NSArray* urls = [dialog_as_open URLs];
const char *files[[urls count] + 1];
@@ -166,8 +165,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
}
}];
} else {
// NSModalResponseOK for >= 10.10
if ([dialog runModal] == NSOKButton) {
if ([dialog runModal] == NSModalResponseOK) {
if (dialog_as_open) {
NSArray* urls = [dialog_as_open URLs];
const char *files[[urls count] + 1];
+2
View File
@@ -1230,6 +1230,8 @@ SDL3_0.0.0 {
SDL_GetTrayMenuParentEntry;
SDL_GetTrayMenuParentTray;
SDL_GetThreadState;
SDL_AudioStreamDevicePaused;
SDL_ClickTrayEntry;
# extra symbols go here (don't modify this line)
local: *;
};
+2
View File
@@ -1255,3 +1255,5 @@
#define SDL_GetTrayMenuParentEntry SDL_GetTrayMenuParentEntry_REAL
#define SDL_GetTrayMenuParentTray SDL_GetTrayMenuParentTray_REAL
#define SDL_GetThreadState SDL_GetThreadState_REAL
#define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL
#define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL
+2
View File
@@ -1263,3 +1263,5 @@ SDL_DYNAPI_PROC(SDL_TrayMenu*,SDL_GetTrayEntryParent,(SDL_TrayEntry *a),(a),retu
SDL_DYNAPI_PROC(SDL_TrayEntry*,SDL_GetTrayMenuParentEntry,(SDL_TrayMenu *a),(a),return)
SDL_DYNAPI_PROC(SDL_Tray*,SDL_GetTrayMenuParentTray,(SDL_TrayMenu *a),(a),return)
SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return)
SDL_DYNAPI_PROC(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),)
+7 -4
View File
@@ -26,7 +26,9 @@
#include "SDL_keymap_c.h"
#include "../video/SDL_sysvideo.h"
// #define DEBUG_KEYBOARD
#if 0
#define DEBUG_KEYBOARD
#endif
// Global keyboard information
@@ -160,7 +162,7 @@ void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event)
SDL_free(SDL_keyboards[keyboard_index].name);
if (keyboard_index != SDL_keyboard_count - 1) {
SDL_memcpy(&SDL_keyboards[keyboard_index], &SDL_keyboards[keyboard_index + 1], (SDL_keyboard_count - keyboard_index - 1) * sizeof(SDL_keyboards[keyboard_index]));
SDL_memmove(&SDL_keyboards[keyboard_index], &SDL_keyboards[keyboard_index + 1], (SDL_keyboard_count - keyboard_index - 1) * sizeof(SDL_keyboards[keyboard_index]));
}
--SDL_keyboard_count;
@@ -206,6 +208,7 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)
{
int keyboard_index = SDL_GetKeyboardIndex(instance_id);
if (keyboard_index < 0) {
SDL_SetError("Keyboard %" SDL_PRIu32 " not found", instance_id);
return NULL;
}
return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);
@@ -217,7 +220,7 @@ void SDL_ResetKeyboard(void)
int scancode;
#ifdef DEBUG_KEYBOARD
printf("Resetting keyboard\n");
SDL_Log("Resetting keyboard\n");
#endif
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) {
if (keyboard->keystate[scancode]) {
@@ -514,7 +517,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb
const Uint8 source = flags & KEYBOARD_SOURCE_MASK;
#ifdef DEBUG_KEYBOARD
printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released");
SDL_Log("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released");
#endif
// Figure out what type of event this is
Loaded 100 of 202 files, more files were not shown because too many files have changed in this diff. Show more