Compare commits

..

302 Commits

Author SHA1 Message Date
Anonymous Maarten
9c821dc21c Add test sources to mingw release artifact 2024-12-07 02:05:30 +01:00
Sam Lantinga
826c56b67c Updated to version 2.30.10 for release 2024-12-06 14:35:53 -08:00
Anonymous Maarten
f3245a6fed vc: bump CMake compatibility version of sdl2-config.cmake
(cherry picked from commit c46bec009b)
2024-12-05 04:30:54 +01:00
Frank Praznik
43e9c5b247 wayland: Check the returned display value for null
In reality, this condition will never occur, since the index is checked before calling the display retrieval function, but aggressive LTO with jump threading can generate a warning if this isn't explicitly checked.

(cherry picked from commit 91bb1bb6fd)
2024-12-03 11:54:11 -05:00
Sam Lantinga
6d9ab4c984 Fixed potential buffer overflow
(cherry picked from commit 6aab5a089d)
(cherry picked from commit e539135104)
2024-12-03 08:34:49 -08:00
Christian Ehrhardt
5418740c4a dynapi: order for a reproducible build
The objfiles of different builds show various differences in
the calls to SDL_DYNAPI_entry elements. This is generated
dynamically by gendynapi.pl which uses an unordered opendir/readdir
pair. To make the build reproducible and thereby e.g. debugging
easier change this to be used in an ordered fashion.

Fixes #11565.
2024-12-02 09:52:30 -08:00
staphen
0251b14be3 Fix order of events in case audio buffer size changes
(cherry picked from commit a4ec0b1531)
2024-11-28 22:29:10 +03:00
Ivan Epifanov
2e43a69a5c Vita: implement mousewheel and buttons 4/5
(cherry picked from commit 6428cee892)
2024-11-27 08:24:08 -08:00
Peter Seiderer
056a4a0960 DirectFB: fix DirectFB_SetTextureScaleMode() declaration
Fixes:

  src/video/directfb/SDL_DirectFB_render.c: In function ‘DirectFB_CreateRenderer’:
  src/video/directfb/SDL_DirectFB_render.c:1153:35: error: assignment to ‘void (*)(SDL_Renderer *, SDL_Texture *, SDL_ScaleMode)’ from incompatible pointer type ‘void (*)(void)’ [-Wincompatible-pointer-types]
   1153 |     renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode;
        |                                   ^

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Notes:
  - declaration was just recently changed by commit 'Fix warning for Android
    NDK compiler: "function declaration without a prototype is deprecated in
    all versions of C [-Wstrict-prototypes]"', see
    ccade50587
(cherry picked from commit b64540dd66)
2024-11-27 08:21:58 -08:00
Sam Lantinga
1bb627514d Fixed build
(cherry picked from commit a5da9be5e6)
2024-11-25 05:01:04 +03:00
Starbuck5
1e3465dc99 Speed up full-surface fills
(cherry picked from commit 7a3f5ef129)
(cherry picked from commit 9f07ac8bba)
2024-11-24 17:45:52 -08:00
Anonymous Maarten
2f873636c7 cmake: ios and tvos applications need to link to SDL2main library
Backport of 52090046fe
2024-11-24 00:09:55 +01:00
Anonymous Maarten
cb3e9578e3 GDK: Fix msbuild project for latest Windows GDK desktop release 2024-11-24 00:04:52 +01:00
Anonymous Maarten
eecf3aab80 Fix -Wdeclaration-after-statement warnings
(cherry picked from commit 248cb3ca9c)
2024-11-23 23:45:19 +01:00
Anonymous Maarten
779a6637b2 ci: setup-gdk-desktop needs build-scripts/setup-gdk-desktop.py 2024-11-23 23:42:35 +01:00
Anonymous Maarten
482ff3b911 ci: add setup-gdk-desktop action
backport of 31b3f5ea79
2024-11-23 23:30:38 +01:00
Anonymous Maarten
616923c1b0 cmake: fix building UWP with non-MSVC generator
(cherry picked from commit 7fb8b62a4d)
2024-11-23 23:28:29 +01:00
Anonymous Maarten
c57874fde0 ci: fix clang-cl job 2024-11-23 23:02:06 +01:00
Anonymous Maarten
9eebee9ff0 Fixup 'ci: merge all workflows' 2024-11-23 22:40:00 +01:00
Anonymous Maarten
bc8a1fd7d5 ci: merge all workflows
(cherry picked from commit ba433e4a5d)
2024-11-23 20:19:33 +01:00
Anonymous Maarten
01dee787c1 ci: pin Windows SDK version to 10.0.22621.0 for Windows on 32-bit ARM 2024-11-22 22:12:35 +01:00
Anonymous Maarten
eedf76f8ed ci: don't do 'brew install pkg-config' anymore
Assume it is installed by default
2024-11-22 21:47:35 +01:00
Wouter Wijsman
dccd23e6fb PSP: Add locale support
(cherry picked from commit f39c5cf989)
2024-11-22 08:38:31 -08:00
Anonymous Maarten
7217771458 cmake: Compatibility with CMake < 3.10 will be removed in a future CMake version 2024-11-17 21:56:09 +01:00
Ozkan Sezer
3ee780ce9c build system: disable 3dNow! support by default
Closes: https://github.com/libsdl-org/SDL/issues/11472.
(cherry picked from commit 51570d9257)
2024-11-17 17:55:32 +03:00
jimtahu
bee8874629 Always Use Next Display Index
WIN_AddDisplay asserted that the returned index is the expected next
one in the list. This can be an unexpected number when displays are
add and removed in a batch (eg, Remote Desktop disconnect and reconnect).
Instead always just make use of the next index, even if it is not the
expected next index value. This fixes issue #9105
2024-11-15 14:03:42 -08:00
rsn8887
11ffdd3abc SDL_vitatouch.c: re-enable front touch on Vita
(cherry picked from commit 6dcf75710c)
2024-11-15 10:15:10 -08:00
Zack Middleton
6f859d90f1 Fix SDL_PRIs64 to use standard PRId64
PRIs64 doesn't exist in C standards.

(cherry picked from commit 8a2cac7aaa)
(cherry picked from commit 761ea32b74)
2024-11-15 10:15:10 -08:00
Ryan C. Gordon
96f4421e5f audio: Favor OpenSL ES over AAudio.
There are low-latency fixes in SDL3 that really need to be backported to SDL2
before AAudio will be nicer across a range of devices, so OpenSL ES is safer
in SDL2 at the moment. At least, we suspect as such.

Fixes #11457.

(cherry picked from commit 17b9ed7d82)
2024-11-13 18:25:47 -05:00
Sam Lantinga
ad602924a4 Support multiple joystick buttons bound to the same gamepad button
(cherry picked from commit ed943318e2)
(cherry picked from commit 74ff82f4a2)
2024-11-05 11:52:07 -08:00
Anonymous Maarten
9eca707549 cmake: releases have a REVISION.txt instead of VERSION.txt 2024-11-04 19:20:23 +01:00
Anonymous Maarten
4fc47a774f port build-script from SDL3
[ci skip]
2024-11-02 02:19:50 +01:00
Sam Lantinga
c98c4fbff6 Updated to version 2.30.9 for release 2024-11-01 14:24:51 -07:00
Sam Lantinga
4d4f004968 Fixed the PS5 controller face buttons on Amazon Fire TV, Android 11
(cherry picked from commit 09495059df)
(cherry picked from commit 3b7a45853c)
2024-10-30 05:24:08 -07:00
Sam Lantinga
5d7a023430 Revert "aaudio: Set low-latency audio mode."
This reverts commit 1e016fd5ea.

In order to use low latency mode, you need to set low latency callbacks. This has always been recommended and is apparently required on Android 15. SDL3 has these implemented correctly but SDL2 does not, so we should revert this for now.

Fixes https://github.com/libsdl-org/SDL/issues/11376

(cherry picked from commit d2b9ecd281)
2024-10-29 22:36:54 -07:00
dv-senna
3e272e73d6 SDL_vulkan.h: undefine VK_DEFINE_HANDLER and VK_DEFINE_NON_DISPATCHABLE_HANDLE
Allows including vulkan.hpp in user code in C++ before SDL_vulkan.h w/o errors.
Fixes:  https://github.com/libsdl-org/SDL/issues/11328 .

(cherry picked from commit 149ecffd6f)
(cherry picked from commit 478dff3585)
2024-10-29 22:36:24 -07:00
Ryan C. Gordon
cc2352f842 wasapi: Deal with device buffer sizes changing.
Otherwise, it would fill the previous size's worth of data into the current
size's buffer.

Fixes #11122.

(cherry picked from commit 5b0e838a74)
2024-10-29 22:36:19 -07:00
Ryan C. Gordon
f170ced2a7 cocoa: Patched to compile.
(cherry picked from commit e5348c611d)
2024-10-25 10:23:36 -04:00
Ryan C. Gordon
dcdb763de8 cocoa: Make sure GL context destruction happens on the main thread.
Fixes #10900.

(cherry picked from commit 5cb87ff99f)
2024-10-25 10:17:47 -04:00
Ryan C. Gordon
5c9f37080e emscripten: scale mousewheel X coordinates correctly, not just Y coordinates.
Fixes #10454.

(cherry picked from commit 00f15dd215)
2024-10-23 23:41:10 -04:00
Ivan Epifanov
257d75429d VITA: fix SDL_ShowMessageBox by using different memory type
(cherry picked from commit 52714d5063)
2024-10-22 12:22:20 -07:00
Frank Praznik
c1adfb4c94 wayland: Always create a viewport for the window if available
Viewports decouple the buffer from the window size and avoids the window geometry hacks used to prevent problems if a buffer with an old size in the pipeline ends up being committed.

Fixes an invalid geometry warning and incorrect overview size for fullscreen windows on GNOME, and avoids flicker when entering/exiting fullscreen or moving the window between scaled and non-scaled displays.

(cherry picked from commit 849c905d8c)
2024-10-21 15:22:24 -04:00
Ivan Epifanov
217bc17a21 VITA: fix yuv texture update
(cherry picked from commit 86fd4ed83c)
2024-10-17 07:54:41 -07:00
Sam Lantinga
7107e02315 Only use Steam Virtual Gamepads if we're running under Steam
Fixes https://github.com/libsdl-org/SDL/issues/11214
Fixes https://github.com/libsdl-org/SDL/issues/11215

(cherry picked from commit 8a30def5f2)
(cherry picked from commit b6fa4dc794)
2024-10-16 17:53:01 -07:00
Sam Lantinga
062a777240 Added support for the Steam Virtual Gamepad on macOS Sequoia
(cherry picked from commit d7b1ba1bfc)
(cherry picked from commit cfb3db01dc)
2024-10-16 17:53:01 -07:00
Pierre Wendling
1842745c9c VisualC: Set the correct component to false.
When SDL2_main would not be found, it would incorrectly flag the shared SDL2 library as not found.

(cherry picked from commit 378234437f)
2024-10-13 09:03:22 -07:00
Cameron Cawley
bbcc9421d6 3DS: Support simple message boxes
(cherry picked from commit 23d456e146)
2024-10-13 09:03:22 -07:00
Cameron Cawley
b58a1c7f33 3DS: Only bundle resources with tests that need them
(cherry picked from commit d7bb56f163)
2024-10-13 09:03:22 -07:00
Cameron Cawley
79a8f7b3a0 Reduce the size of the SDL_blit_0 alpha code
(cherry picked from commit 90f792f83c)
2024-10-13 09:03:22 -07:00
Cameron Cawley
302ab09178 testdrawchessboard: Allow using the standard render API
(cherry picked from commit e2f27362cb)
2024-10-13 09:03:22 -07:00
Guldoman
e1e38e2250 x11: Set correct clipboard target type in SelectionRequest handling
(cherry picked from commit 5fe010270a)
2024-10-13 09:02:49 -07:00
Sam Lantinga
2638809c50 Fixed typo in SDL_audio.h
(cherry picked from commit da4608ed03)
2024-10-10 08:50:19 -07:00
Sam Clegg
36853f923e [emscripten] Fixes for data addresses above 2gb
This includes both wasm64 and wasm32 when addressing more than 2gb of
memory.

Fixes: #9052
(cherry picked from commit 3deb07ea39)
2024-10-08 15:17:44 -07:00
Sam Lantinga
63aff8e3d0 Added support for wired XBox controllers on macOS 15.0 Sequoia
Fixes https://github.com/libsdl-org/SDL/issues/11002

(cherry picked from commit 7da728a642)
(cherry picked from commit da19244f7f)
2024-10-07 16:41:47 -07:00
Sam Lantinga
7eebc2ad4d Fixed detecting the Steam Virtual Gamepad on macOS
(cherry picked from commit bb33eb409e)
2024-10-07 16:22:03 -07:00
Frank Praznik
0f695adb03 Reapply "wayland: Don't initialize OpenGL when the window flags didn't specify it"
This reverts commit 120b8d4189.

The issue this was patching over in Vanilla-Conquer was the lack of an exposure event when showing a window, which has since been remedied.

Attaching EGL window objects can also cause protocol violations now that the explicit sync protocol is in use, if SDL creates one and then the client tries to attach one itself, so they really shouldn't be created unless the client specifically requested it.

(cherry picked from commit 643437f5b0)
2024-10-02 13:52:59 -04:00
Anonymous Maarten
79ec168f3c Add docs to mingw release and don't modify libtool files in mingw's Makefile
(cherry picked from commit 2b2907db18)
2024-10-01 23:05:24 +02:00
Anonymous Maarten
40a3a80d45 release.yml needs setup-ninja 2024-10-01 21:38:05 +02:00
Anonymous Maarten
025fc35c87 Port SDL3 release scripts to SDL2
[skip ci]

(cherry picked from commit 8291b1be36)
2024-10-01 21:22:06 +02:00
Sam Lantinga
e9f5f3ac1f Updated to version 2.30.8 for release 2024-10-01 09:25:57 -07:00
Sam Lantinga
235c87dc92 Don't use BlitARGBto555PixelAlpha() for SDL_PIXELFORMAT_ARGB1555
This didn't properly take into account destination alpha.

Fixes https://github.com/libsdl-org/SDL/issues/8401

(cherry picked from commit 1aea43846e)
(cherry picked from commit c9f3cbe02f)
2024-09-25 21:58:42 -07:00
Cameron Gutman
b6535836aa Throttle tickle reports to PS4/PS5 controllers
UpdateDevice() can be called at an arbitrary rate, so we need to
pace ourselves to avoid filling up the rumble queue with these.

(cherry picked from commit 6ec8b1a173)
(cherry picked from commit 656b599828)
2024-09-25 07:23:09 -07:00
Cameron Gutman
5e90dd3507 kmsdrm: Fix one more place that doesn't try to drop master
(cherry picked from commit 7eb85b07e0)
2024-09-23 19:11:42 -05:00
Cameron Gutman
d9139ff3de kmsdrm: Keep fd around if we can drop master
Modern kernels (v5.8+) allow non-root usage of drmDropMaster(), so
we can hold on to our fd after dropping master on it. This fixes
populating drm_fd in the KMSDRM SysWMinfo when using Vulkan.

Also add a missing error check for open() while we're here.

(cherry picked from commit dab4f856c1)
2024-09-23 08:12:58 -07:00
T3hD0gg
5669b97fd7 Add Thrustmaster TMX VID & PID to wheel device list.
(cherry picked from commit 594edb6bd2)
(cherry picked from commit ec9a9fee58)
2024-09-18 22:22:22 -07:00
Cameron Gutman
6f0fae7432 wayland: Fix memory leaks
(cherry picked from commit e239295491)
2024-09-18 20:46:20 -04:00
Anders Jenbo
1c4dd015ac Spell "unknown" correctly
(cherry picked from commit ee377793fe)
(cherry picked from commit d9b4b7d0e0)
2024-09-13 12:30:16 -07:00
Ryan C. Gordon
e9efcfb428 pulseaudio: Hotplug thread fixes.
This used a tiny stack, which apparently upsets Blender for various
technical reasons. Instead, just use the default stack size, which should
give it plenty of space to work.

If the thread failed to create, we would then wait on a semaphore that would
never trigger, so don't do that anymore!

Fixes #10806.

(cherry-picked from commit b7dc30ca24)

(cherry picked from commit 58f2586b44)
2024-09-12 15:15:08 -07:00
Frank Praznik
d32189918b wayland: Send exposure events when showing or resizing the window
Clients may rely on this event to signal when they should redraw themselves, so send it when appropriate.

(cherry picked from commit 8fa99993af)
2024-09-10 10:22:45 -04:00
Simon McVittie
38d3b1b6d6 x11vulkan: Use the correct SONAME of libX11-xcb.so.1 on Linux, etc.
On most Unix platforms supported by SDL, the canonical name used to load
a library at runtime includes its ABI major version, and the name
without a version is not guaranteed to exist on non-developer systems.
libX11-xcb.so.1 is correct on Linux, and probably on other Unix
platforms like FreeBSD.

A notable exception is OpenBSD, which apparently does not use
ABI-suffixed names, so continue to use libX11-xcb.so there.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 7713a7eec7)
(cherry picked from commit 54757c29dd)
2024-09-09 12:54:20 -07:00
vanfanel
1df907b1ba Add SDL_VIDEO_DOUBLE_BUFFER support to the Wayland backend.
(cherry picked from commit 9e6b8d56e3)
2024-09-08 07:30:22 -07:00
Sam Lantinga
00a7191f67 SDL_XINPUT_Enabled() returns false until XInput DLL is successfully loaded
We make sure we initialize XInput first, so that anything checking whether it's enabled gets a valid result based on whether we were able to load it or not.

(cherry picked from commit 8f46cb771c)
(cherry picked from commit f5ed158d1f)
2024-09-06 11:24:58 -07:00
Sam Lantinga
d53b22e8f0 Fixed race condition at startup that could cause a crash in the XInput driver
(cherry picked from commit 6d7c211faf)
(cherry picked from commit 5aadfd4eaf)
2024-09-06 10:38:16 -07:00
Sam Lantinga
e5bb4fa90f Fixed memory leak in testthread
(cherry picked from commit dfe6efcd2d)
(cherry picked from commit 224a37faab)
2024-09-05 07:20:05 -07:00
Sam Lantinga
ba9b075eba Use atomic variables for thread communication
Fixes https://github.com/libsdl-org/SDL/issues/10711

(cherry picked from commit a0f36fb85b)
(cherry picked from commit a75227aaeb)
2024-09-05 07:19:09 -07:00
Sam Lantinga
85b2733324 Make newer DRM and GBM functions optional
Fixes https://github.com/libsdl-org/SDL/issues/10675

(cherry picked from commit d501f6db07)
(cherry picked from commit 10b4a79379)
2024-09-02 13:08:47 -07:00
Sam Lantinga
9519b9916c Updated to version 2.30.7 for release 2024-09-01 08:11:12 -07:00
Ozkan Sezer
00494df2f1 RAWINPUT_JoystickOpen: add missing SDL_stack_free() calls.
Fixes https://github.com/libsdl-org/SDL/issues/10574.
(cherry picked from commit 845212388e)
(cherry picked from commit 4eac44bed4)
2024-08-25 11:05:56 +03:00
Sam Lantinga
948196448f Added support for the Retro-bit Controller in PS3 mode
Fixes https://github.com/libsdl-org/SDL/issues/10557

(cherry picked from commit e75175129f)
(cherry picked from commit 0de601dc64)
2024-08-19 16:50:00 -07:00
Ozkan Sezer
7ca3d26e7a SDL_x11mouse.c: avoid -Wunused-variable if xinput2 is not available
(cherry picked from commit 30972d7e7f)
2024-08-17 11:23:32 +03:00
Frank Praznik
f79d28085d wayland: Send fake warp coordinates when emulating warps with relative mode
Send the fake warp coordinates when emulating warps with relative mode to ensure that it appears that the cursor is always reset to where the application expects it to be.

Fixes cases where games can continue moving the camera if the mouse is lifted during motion.

(cherry picked from commit 8fcbf972c6)
2024-08-16 11:27:44 -04:00
Frank Praznik
74a005f73f x11: Track cursor visibility internally
Cursor visibility in the SDL input layer only reflects whether ShowCursor/HideCursor was called. In the case of relative mode, the cursor can be hidden, but the SDL_Mouse visibility flag will be true.

Track cursor visibility separately in the X11 driver. Fixes the cursor becoming visible when using the warping relative mode with XWayland.

(cherry picked from commit b0713a7d30)
(cherry picked from commit 5b57573439)
2024-08-16 10:36:33 -04:00
Sam Lantinga
6f7aa1e755 Use drmModeAddFB() if drmModeAddFB2WithModifiers() fails
Fixes https://github.com/libsdl-org/SDL/issues/10276

(cherry picked from commit 8e99ec34bb)
(cherry picked from commit b360214950)
2024-08-15 11:54:06 -07:00
Wohlstand
847a6cce96 SDL_vitatouch.c: Fixed the incorrect touch device IDs
- Begining of device ID with 0 violates the SDL's specification that means the 0 is an error, invalid, failure, etc. But on Vita here it's an actual device...
- Replacing 0 and 1 with 1 and 2 to resolve this violation.

(cherry picked from commit dd6c663918)
2024-08-14 08:39:58 -07:00
Sam Lantinga
95aed34a69 Fixed build
(cherry picked from commit 70890b175e)
2024-08-13 09:36:36 -07:00
Ilya Mizus
21e0382edd Fixed secondary screens on KMSDRM (#10535)
* Removed window movement to left top corner that breaks secondary screens on KMSDRM

(cherry picked from commit ce98550cbb)
(cherry picked from commit 586a2dc721)
2024-08-13 09:36:36 -07:00
KaJe
0cdfdb9970 Add Cammus C12 VID & PID to wheel device list.
Add Cammus C12 in the SDL wheel list to enable wheel detection for them.

(cherry picked from commit e1571d704d)
(cherry picked from commit 5ecbc00f36)
2024-08-09 06:49:06 -07:00
Sam Lantinga
f75b0aa814 kmsdrm: free the connector when looking for available devices
Fixes https://github.com/libsdl-org/SDL/issues/10499

(cherry picked from commit 1a57ea7fba)
(cherry picked from commit a5bff78d81)
2024-08-08 09:30:33 -07:00
Sam Lantinga
403f87340f Fixed crash when the current mouse capture window is destroyed
Fixes https://github.com/libsdl-org/SDL/issues/10494

(cherry picked from commit 91d97a367e)
(cherry picked from commit 5ca0639a42)
2024-08-07 12:36:04 -07:00
Sam Lantinga
07cfc34a2e Added detail about why a file couldn't be opened (thanks mgerhardy!)
Fixes https://github.com/libsdl-org/SDL/issues/10484

(cherry picked from commit 1512013320)
2024-08-06 05:46:37 -07:00
Anonymous Maarten
4222cebef6 Use SDL_test + don't use macros
The structure of the existing loop makes the inner loop of the previous commit unnecessary.

Manual backport of 558630d59c

(cherry picked from commit 62f35ab1b6)
2024-08-05 07:25:35 -07:00
Sam Lantinga
1e2aa2363b Implemented left-justification in SDL_PrintString()
Fixes https://github.com/libsdl-org/SDL/issues/10310

(cherry picked from commit f59d66f4b1)
(cherry picked from commit 2efbe7fa3f)
2024-08-04 20:07:06 -07:00
vanfanel
0b25cd2196 Fix KMSDRM double buffering.
(cherry picked from commit 5ab1151508)
2024-08-04 15:53:44 -07:00
Anonymous Maarten
b7457ff61b cmake: SDL2 target is not always available
(cherry picked from commit 7cf3234efe)
2024-08-04 15:53:17 +02:00
Sam Lantinga
ba2f78a006 Updated to version 2.30.6 for release 2024-08-01 14:16:41 -07:00
Sam Lantinga
dcbdf09709 Fixed macOS build
(cherry picked from commit 230f1debd0)
2024-08-01 14:15:16 -07:00
Sam Lantinga
a9b11980d2 Fixed building on macOS with OpenGL disabled
Fixes https://github.com/libsdl-org/SDL/issues/6226

(cherry picked from commit 0b6eff4167)
2024-08-01 14:04:27 -07:00
Sam Lantinga
906d0e9c03 Fixed crash with joystick rumble after disconnection
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

Fixes https://github.com/libsdl-org/SDL/issues/10422

(cherry picked from commit 0a924b185d)
(cherry picked from commit 7fdf794377)
2024-07-29 13:51:22 -07:00
Sam Lantinga
0952ab1ab9 Fixed whitespace
(cherry picked from commit 67b973b5fa)
(cherry picked from commit 15c73f5bfe)
2024-07-29 12:52:54 -07:00
Charles Cross
7635776ca4 Updates CheckLibUDev() to match main, fixing missing HAVE_LIBUDEV
(cherry picked from commit e306cbcbee)
2024-07-29 07:22:29 -07:00
Ozkan Sezer
76a3457ad5 SDL_mslibc.c: revert PR/10303 changes
(cherry picked from commit 2cb2897e50)
2024-07-28 22:50:00 +03:00
Frank Praznik
881c4cb49e wayland: Don't fail to retrieve a system cursor if no window is focused
Doing this can leave the cursor data in a weird, corrupt state.

(cherry picked from commit 5617ce277d)
(cherry picked from commit 5d1ca1c8c7)
2024-07-27 20:32:33 -04:00
Ozkan Sezer
0406d1c316 testshader.c: include stdlib.h for exit() 2024-07-22 17:40:56 +03:00
Ozkan Sezer
1ca76a29d9 SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR/10331)
Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: https://github.com/libsdl-org/SDL/issues/6078 which was fixed by
f6b81125b3

(cherry picked from commit 70c1012e8c)
(cherry picked from commit 86b4d035db)
2024-07-22 16:02:50 +03:00
Anonymous Maarten
e53df5b07e stdinc: c23 deprecated _Static_assert in favor of static_assert
(cherry picked from commit 22bfbdbc02)
(cherry picked from commit 5d606eaae2)
2024-07-21 13:18:55 -07:00
Amir
e7a47e783b Fix warning for Android NDK compiler: "function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]"
https://stackoverflow.com/questions/42125/warning-error-function-declaration-isnt-a-prototype
In C int foo() and int foo(void) are different functions. int foo() accepts an arbitrary number of arguments, while int foo(void) accepts 0 arguments. In C++ they mean the same thing.

(cherry picked from commit ccade50587)
2024-07-17 14:48:06 -07:00
Ryan C. Gordon
279eb89ce5 README-macos: Typo fixes.
(Manually cherry-picked from 199e6929e5284b8573f02dcb655d3803ed436615.)
2024-07-16 08:32:29 -04:00
Anonymous Maarten
fe9020dcb8 pthread: timespec.tv_nsec must be less then 1000000000 ns
(cherry picked from commit 1ef041a2ca)
2024-07-14 17:29:33 +02:00
ceski
4927836b2d Add a Windows mapping for SplitFish Game Controller
(cherry picked from commit 68cf17d0d4)
(cherry picked from commit 3b7eafedb3)
2024-07-12 22:04:47 -07:00
Anonymous Maarten
5a072d38db cmake: only add SDL_LIBC=0 compile options to SDL2 libraries 2024-07-12 23:18:06 +02:00
Sam Lantinga
2d1ebf4850 Make sure SDL subsystems are initialized before starting threads
(cherry picked from commit b057159db7)
2024-07-12 09:11:38 -07:00
Sam Lantinga
44ec2027f3 Make sure timers are initialized before any threads start
This prevents race conditions and divide by zero if multiple threads start using the time functions simultaneously.

(cherry picked from commit b378bc5c83)
2024-07-12 08:02:09 -07:00
Sam Lantinga
000da98663 Fixed OS/2 build
(cherry picked from commit b13dcf24d6)
2024-07-11 13:56:11 -07:00
Sam Lantinga
87ba287f81 Added TLS initialization and shutdown functions
Fixes https://github.com/libsdl-org/SDL/issues/8576

(cherry picked from commit b517043936)
(cherry picked from commit 551164812a)
2024-07-11 13:10:40 -07:00
Ozkan Sezer
d133701a72 ci: bump FreeBSD
Reference issue: https://github.com/libsdl-org/SDL/issues/10224.

(cherry picked from commit 956a8bf6c0)
2024-07-11 18:55:56 +03:00
Substring
4635f8597d KMSDRM: fix unsupported modifiers
(cherry picked from commit 9548bba63a)
(cherry picked from commit a2215ff81c)
2024-07-10 14:43:06 -07:00
Sam Lantinga
802351be25 Fixed build
(cherry picked from commit 026dfc6305)
2024-07-08 11:39:25 -07:00
Sam Lantinga
d3765b27c2 Make sure we're actually running on Windows before using D3D renderers
(cherry picked from commit e22c89536a)
2024-07-08 11:29:29 -07:00
mariob92
7b11fff2ee wgl/glx: Fix attribute list for SDL_GL_FLOATBUFFERS
This commit fixes the attribute list in the WGL and GLX code when requesting a floating point pixel format. The name of the attribute was missing in the list.

Fixes libsdl-org#10189

(cherry picked from commit 9389712917)
(cherry picked from commit 58e179c8b5)
2024-07-06 11:57:23 -07:00
Sam Lantinga
de4573275a Improved detection of Nintendo Switch Pro controller report mode
Fixes https://github.com/libsdl-org/SDL/issues/10182

(cherry picked from commit 4ba2e9f4f4)
(cherry picked from commit 4c44450258)
2024-07-06 05:30:41 -07:00
Ozkan Sezer
275c94c900 SDL_hidapi.c: work-around watcom build error when libusb is enabled
(cherry picked from commit 6a10309568)
2024-07-05 18:56:20 +03:00
Max Maisel
c084e647ed Drain HIDAPI buffer in SDL_hidapi_steamdeck.c.
Add a loop around SDL_hid_read() in the Steam Deck HIDAPI driver as it
is done in other HIDAPI drivers. This loop reads data from the device and
processes it until the input buffer is empty which ensures that clients
always get the latest data.

This fixes an input latency issue if the application polls the events
slower than the hardware generates them.

(cherry picked from commit 22770e6496)
2024-07-05 08:29:01 -07:00
Sam Lantinga
2cdb419a21 Try to create an accelerated renderer for the window surface even if SDL_HINT_RENDER_DRIVER is "software"
This case is properly handled inside SDL_CreateWindowTexture()

Fixes https://github.com/libsdl-org/SDL/issues/10155

(cherry picked from commit c7ed78a9ef)
(cherry picked from commit a4cbba1276)
2024-07-05 08:23:39 -07:00
Sam Lantinga
2eef7ca475 Updated to version 2.30.5 for release 2024-07-03 14:21:42 -07:00
Sam Lantinga
d126e7bbba Added support for the ROG RAIKIRI
(cherry picked from commit a04596c9a7)
(cherry picked from commit 845ebbbe96)
2024-07-03 13:54:52 -07:00
Sam Lantinga
e5024fae3d If a mapping specifies a crc, don't match for controllers that don't have that CRC
The CRC is used to distinguish between different controllers that have the same VID/PID, so if the CRC doesn't match, it's probably a different controller that we don't know about.

Fixes https://github.com/libsdl-org/SDL/issues/9265

(cherry picked from commit 30e93b40c2)
(cherry picked from commit b8daf14fe5)
2024-07-03 13:25:13 -07:00
Ryan C. Gordon
eb053c7f3f SDL_JoystickEventState: Make documentation and implementation match.
This changes the `SDL_EVENTS_DISABLED` path's return value from SDL_DISABLE
to SDL_IGNORE to match expectations, but doesn't actually change the ABI,
since these two symbols are both zero.

Fixes https://github.com/libsdl-org/sdlwiki/issues/460

(cherry picked from commit 7d60ff9965)
2024-07-03 13:24:19 -07:00
Sam Lantinga
ed441c8289 Turn HIDAPI joystick support off by default on mobile platforms
On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers.

Fixes https://github.com/libsdl-org/SDL/issues/9241

(cherry picked from commit e3cf2e4794)
(cherry picked from commit 66054a6515)
2024-07-03 13:23:04 -07:00
Wouter Wijsman
59b0a1dc65 PSP: send initial SDL_JOYDEVICEADDED event
(cherry picked from commit 5d80179954)
2024-07-03 13:22:03 -07:00
Sam Lantinga
80d36aba5b Only use the default gamepad mapping if an automatic mapping isn't available
Fixes https://github.com/libsdl-org/SDL/issues/10162

(cherry picked from commit 0f8054cf87)
(cherry picked from commit cd8ea5e3f1)
2024-07-03 11:47:46 -07:00
Sam Lantinga
e1e36d213b Fixed build
(cherry picked from commit 288aea3b40)
2024-06-29 11:22:48 -07:00
Sam Lantinga
5c8d92e4d0 Respect SDL_HINT_RENDER_DRIVER when creating an accelerated window surface
Fixes https://github.com/libsdl-org/SDL/issues/10061

(cherry picked from commit 2a58e7b11c)
(cherry picked from commit 0d9e54237c)
2024-06-29 11:13:50 -07:00
Sam Lantinga
8a39054b54 Clean up any renderer in SDL_DestroyWindowSurface()
Also added an automated test to verify window surface functionality.

Fixes https://github.com/libsdl-org/SDL/issues/10133

(cherry picked from commit a522bfe3f1)
(cherry picked from commit a3f0c373d3)
2024-06-29 11:13:36 -07:00
1F616EMO
c60e2704c8 Remove the inconsistent and lag-causing usleep call in SDL_fcitx.c
(cherry picked from commit 3bf2b90da0)
2024-06-29 00:09:34 -07:00
Sam Lantinga
a9fdbf7f21 Make sure we don't try to use the XInput DLL after it's unloaded
Steam ran into a crash SDL_XINPUT_JoystickDetect() with XINPUTGETCAPABILITIES being NULL. I'm not sure how that happened, and there may still be a race condition if this is a multi-threaded issue, but at least this is more correct.

(cherry picked from commit 0ae4fd0ec9)
(cherry picked from commit ee3b2b7de1)
2024-06-26 15:56:21 -07:00
Sam Lantinga
ed86b02df8 Fixed building with older libdrm headers
(cherry picked from commit 8949de3978)
(cherry picked from commit 88bbab275f)
2024-06-26 15:56:20 -07:00
Sam Lantinga
0811b4dc51 Fixed building with the steamrt/scout SDK
(cherry picked from commit 4b82bed259)
(cherry picked from commit ecde0ca6b6)
2024-06-26 15:56:20 -07:00
Sam Lantinga
d9901e0b85 Fix building with the steamrt/scout SDK
(cherry picked from commit b552f26e6a)
(cherry picked from commit 64d4baccb5)
2024-06-26 15:56:20 -07:00
Frank Praznik
0f5752b0fc video: Fix memory leak when deleting a video display
The display deletion code would not free the driver data or name if the display index was the last, or only one, in the list.

(cherry picked from commit 20f1061cc8)
2024-06-26 12:32:07 -04:00
Frank Praznik
31f77182d0 wayland: Fix double free when deleting an output display
(cherry picked from commit 3b88d4f46f)
2024-06-26 12:31:51 -04:00
Cecill Etheredge
620e875335 fix: Use drmModeAddFB2WithModifiers instead of drmModeAddFB to allow using GBM modifiers.
This fixes corrupt framebuffers on platforms that require the use of modifiers.
2024-06-25 14:20:36 -07:00
Edoardo Lolletti
c18173c260 Fix std::thread memory leak
In the stdcpp thread implementation, the allocated std::thread objects were never deleted after joining/detaching

(cherry picked from commit 20dbe90771)
(cherry picked from commit 99d7b9e626)
2024-06-24 11:51:40 -07:00
Ganael Laplanche
f08f458896 Fix joystick (/dev/input/xxx) support on FreeBSD
Backport f8ad4abe from main branch.

When switching to CMake, src/joystick/linux/SDL_sysjoystick.c file got
excluded from FreeBSD builds, losing support for /dev/input/xxx devices.

See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279907
and: https://github.com/libsdl-org/SDL/pull/10087

(cherry picked from commit ab5740bde2)
2024-06-23 00:07:35 -07:00
Blaž Tomažič
53cf48f505 android: add an option to manually pass the context when loading a native library
(cherry picked from commit b444e656cd)
2024-06-20 10:40:05 -07:00
Blaž Tomažič
c32a1a5023 android: actually use ReLinker
When loading libraries the `SDL.mContext` is still `null`. This results in
relinker code path in `SDL.loadLibrary(...)` always throwing a null exception
and fallbacking to system loader.

Fix it by passing the context explicitly.

(cherry picked from commit 6a2dd96ac7)
2024-06-20 09:35:58 -07:00
expikr
8b204815cc Add SDL_MOUSE_RELATIVE_CURSOR_VISIBLE (#7947)
(cherry picked from commit ee559d51be)
(cherry picked from commit 194d72bb29)
2024-06-20 09:32:27 -07:00
Aikawa Yataro
a9bb92b3ae Update qsort implementation
(cherry picked from commit 0fe9f5da54)
(cherry picked from commit 4800edfa0c)
2024-06-19 05:50:00 +03:00
Sam Lantinga
630272eb55 Fixed requesting USB permission on Android 14 (thanks @ikhoeyZX!)
Fixes https://github.com/libsdl-org/SDL/issues/9831

(cherry picked from commit 8ab1ffca8a)
(cherry picked from commit 5a26b26880)
2024-06-17 15:12:05 -07:00
Sam Lantinga
92fe3b19c8 Updated to version 2.30.4 for release 2024-06-17 12:32:13 -07:00
Sam Lantinga
30e2b03a65 Pass through the original name used by the Steam Virtual Gamepad
Proton uses this on Linux to determine what the XInput slot is for the gamepad. Other applications will get the real controller name and VID/PID by virtue of the code in SDL_steam_virtual_gamepad.c

(cherry picked from commit 361cae0874)
(cherry picked from commit a6fdd155fb)
2024-06-17 12:15:18 -07:00
Miku AuahDark
f8943854fd Android: Use SCREEN_ORIENTATION_FULL_USER instead of SCREEN_ORIENTATION_FULL_SENSOR for resizable window.
The former will respect user orientation lock setting while the latter does not.

(cherry picked from commit 3373667faa)
(cherry picked from commit 77285b6c3f)
2024-06-17 09:55:23 -07:00
Ozkan Sezer
325465935d SDL_events.c: remove long long casts an the override of SDL_PRIs64
(cherry picked from commit a4d240d295)
2024-06-14 21:37:24 +03:00
Ozkan Sezer
1cdd37b32c always define PRI?64 using 'I64' when targeting windows
avoids -Wformat warnings from mingw toolchains -- e.g.:
src/test/SDL_test_harness.c:581:37: warning: unknown conversion type character 'l' in format [-Wformat=]

(cherry picked from commit 49b6c24722)
(cherry picked from commit 863670c0a8)
2024-06-14 21:37:10 +03:00
Ozkan Sezer
499bff9c3a SDL_qsort.c: fix calling conventions of private functions' compare args 2024-06-14 14:50:10 +03:00
Sam Lantinga
bd06e43b87 Re-enable full controller reports for Joy-Con controllers
When they are in simple report mode, the thumbstick gets turned into a digital hat, so let's use them in full report mode.

(cherry picked from commit bf27269952)
(cherry picked from commit 169f77ed5e)
2024-06-13 00:02:52 -07:00
Sam Lantinga
72e5620202 Try to guess the type of a Nintendo Switch controller if we can't read the device info
(cherry picked from commit 6619de8f24)
(cherry picked from commit 6b9bf71133)
2024-06-13 00:02:52 -07:00
Sam Lantinga
fbb9646806 Ignore spurious reply packets when reading Nintendo Switch controller reports
(cherry picked from commit 5ee9a840b1)
(cherry picked from commit f1b19aa744)
2024-06-13 00:02:52 -07:00
Sam Lantinga
4b91f0793c Fixed build
(cherry picked from commit 2e8bd8f1f3)
2024-06-07 09:14:33 -07:00
Fabrice Desclaux
6243a80b3f Fix spurious LCtrl on RAlt key pressed
(cherry picked from commit 22c14442e2)
2024-06-07 08:46:29 -07:00
Oleg
e0b0a98c8e Added VRS DirectForce Pro wheelbase VID/PID to wheel devices list
(cherry picked from commit 7529b4bed5)
(cherry picked from commit 0f9191a643)
2024-06-06 09:55:35 -07:00
Frank Praznik
785eac863b wayland: Set the initial min/max limits on non-libdecor windows during a show operation
Libdecor windows will have this done during the first frame configure, but bare xdg-toplevel windows need it set explicitly, or a non-resizable window might be able to be resized.

(cherry picked from commit fc6bbde525)
2024-06-06 09:52:08 -04:00
Sam Lantinga
ab8659922d Fixed PlayStation detection interrupting input for the Logitech K400 keyboard
Also added the Logitech Chillstream to the list of PS3 controllers and fixed the right shoulder axis.

(cherry picked from commit b6d7adfec1)
(cherry picked from commit f520062ad1)
2024-06-05 19:30:10 -07:00
Sam Lantinga
d48f9c4af4 Added support for the Saitek Cyborg V.3 Rumble Pad in PS3 mode
(cherry picked from commit b6ca360228)
(cherry picked from commit e2f597de84)
2024-06-05 19:30:07 -07:00
Sam Lantinga
5cc0644aa0 Added support for the Razer Kitsune in PS5 mode
(cherry picked from commit e3beaa1972)
(cherry picked from commit 35d719ef25)
2024-05-31 15:19:13 -07:00
mechakotik
91accc391d android: Default to custom theme in styles.xml
Custom theme file exists in project, but is not used by app, which is kinda unintuitive. Using it by default so people who not familiar with Android development won't spend lots of time troubleshooting.

(cherry picked from commit 8f88c32ca6)
(cherry picked from commit 1568501dd6)
2024-05-31 11:33:17 -07:00
Anonymous Maarten
3ee20388c5 autotools needs to check d3d12sdklayers.h too
(cherry picked from commit 5e876db89f)
2024-05-28 17:02:49 +02:00
Ozkan Sezer
2449510673 Makefile.in: add VisualC-GDK to SRC_DIST
Fixes https://github.com/libsdl-org/SDL/issues/9913

(cherry picked from commit 0439fc6007)
2024-05-28 14:10:28 +03:00
Ozkan Sezer
2c07ed320e SDL_config_os2.h: remove duplicated HAVE_WCSL* defines.
(cherry picked from commit 6825a4aabb)
2024-05-28 08:01:04 +03:00
Sam Lantinga
607f37dafd Fixed compiling SDL_platform_defines.h on macOS with older compilers (thanks @sezero!)
Fixes #9632

(cherry picked from commit 36015ad5e5)
(cherry picked from commit 8bc47dc3f1)
2024-05-27 14:39:22 -07:00
Anonymous Maarten
acc2e040ce VC+d3d12: use __has_include to detect presence of d3d12 headers
backport of 4fa5006247

(cherry picked from commit 6c29778826)
2024-05-27 02:43:59 +02:00
Anonymous Maarten
faa9bbdc8e cmake: direct3d12 renderer needs d3d12.h and d3d12sdklayers.h
Older MinGW releases don't ship d3d12sdklayers.h

backport of 3af4f120d0

(cherry picked from commit 6c10201e58)
2024-05-27 02:43:29 +02:00
Anonymous Maarten
cf6c760cd3 d3d12: older Windows SDK headers contain wrong function prototypes
Declare correct function pointers ourselves.

Backport of:
- 98fcf112e7
- 89a4d9ae67

(cherry picked from commit c79e616806)
2024-05-25 00:43:46 +02:00
Anonymous Maarten
e49349ac0c d3d12: xbox has no DXGI_PRESENT flags
(cherry picked from commit 54c435409b)
2024-05-25 00:43:41 +02:00
Sam Lantinga
1e5db996ff Added Linux bindings for the Qanba Drone 2 Arcade Joystick
(cherry picked from commit 98a9ca5e32)
(cherry picked from commit 964e0c9b47)
2024-05-23 15:35:17 -07:00
Phena Ildanach
793a0681a9 hidapi: Use a whitelist for libusb when other backends are available
(cherry picked from commit fdf28471c0)
2024-05-17 11:18:45 -07:00
APGR22
825ffaa168 Added NULL pointer check
(cherry picked from commit 961488b0dc)
(cherry picked from commit e4fc07cad0)
2024-05-17 09:01:26 -07:00
Oleg
9ad6a36b7b Added Moza wheelbases VID/PID to wheel devices list
(cherry picked from commit 79cabeef18)
(cherry picked from commit 96e3799495)
2024-05-15 19:43:15 -07:00
Oleg
c3b53c72c7 Added Simucube wheelbases VID/PID to wheel devices list
(cherry picked from commit dc9d9dd85a)
(cherry picked from commit 1f54ee1da6)
2024-05-15 19:43:15 -07:00
Oleg
0800d81fb4 Added Cammus C5 wheelbase VID/PID to wheel devices list
(cherry picked from commit ce9177b64f)
(cherry picked from commit 0c7a83ecd5)
2024-05-15 19:43:15 -07:00
Sam Lantinga
c27219695a Don't enable enhanced report mode for Bluetooth Nintendo Switch controllers by default
This breaks applications using them in DirectInput mode, which isn't worth just getting battery status. We'll turn on enhanced mode if the application enables sensors.

(cherry picked from commit a87fa020ac)
(cherry picked from commit efaa58732a)
2024-05-10 12:19:33 -07:00
Ozkan Sezer
9dcfc308ef SDL_iconv_string: simplify recomputation of outbuf and outbytesleft
Noticed this in SDL-1.2 where gcc-13 emits a -Wuse-after-free warning.
No such warning in SDL2 and SDL3, because unlike SDL1.2, SDL_realloc()
is not a macro expanding to libc realloc(). It warns, of course, if
SDL_realloc() is replaced with plain realloc():

src/stdlib/SDL_iconv.c: In function 'SDL_iconv_string_REAL':
src/stdlib/SDL_iconv.c:824:39: warning: pointer 'oldstring' may be used after 'realloc' [-Wuse-after-free]
  824 |             outbuf = string + (outbuf - oldstring);
      |                               ~~~~~~~~^~~~~~~~~~~~
src/stdlib/SDL_iconv.c:818:30: note: call to 'realloc' here
  818 |             string = (char *)realloc(string, stringsize + sizeof(Uint32));
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(cherry picked from commit 2205626816)
(cherry picked from commit b6899f82fb)
2024-05-10 09:10:48 -07:00
Sam Lantinga
77b3a6afaf Added a Windows mapping for the SPEEDLINK STRIKE Gamepad
Fixes https://github.com/libsdl-org/SDL/issues/9705

(cherry picked from commit 01d560df50)
(cherry picked from commit 8c92af5e54)
2024-05-06 10:11:58 -07:00
Ozkan Sezer
dd42795131 autotools, cmake, macOS: Do not use the system iconv() by default
backport from PR #9676 by @flibitijibibo

(cherry picked from commit d8fbeec096)
2024-05-03 09:52:59 -07:00
Sam Lantinga
fb1497566c Updated to version 2.30.3 for release 2024-05-01 09:14:37 -07:00
Ozkan Sezer
cc6c0fe230 test, watcom.mif: revert f9a46a319b
%copy isn't recognized by older wmake versions.
2024-05-01 17:37:10 +03:00
Ozkan Sezer
f9a46a319b test, watcom.mif: revert 48a0592a4 and use %copy instead
Ref.: https://github.com/open-watcom/open-watcom-v2/issues/1281.
2024-05-01 17:02:28 +03:00
Ozkan Sezer
48a0592a45 test, watcom makefile: change copy command to use a dos path separator
fixes copy failure with recent open watcom wmake changes. (Issue reported
mainstream as https://github.com/open-watcom/open-watcom-v2/issues/1281)
2024-05-01 11:02:04 +03:00
Sam Lantinga
1c74a8b5ae Fixed building with GDK (thanks @Romans-I-XVI!)
(cherry picked from commit 1caa427035)
2024-04-30 10:21:38 -07:00
Austin Sojka
3d18043005 Added GDK app constrained/unconstrained events (#9608)
(cherry picked from commit 7554e82ec3)
2024-04-30 10:21:32 -07:00
Tyson Whitehead
6e1e00701e Initialize udev before joystick manual scan so class lookup works
LINUX_JoystickInit does a manual scan first so devices are sorted.
If SDL_UDEV_Init hasn't run by then, then the product info cannot
be looked up by SDL_UDEV_GetProductInfo and the initial-plugged-
in-device classification falls back to heuristic guessing.

(cherry picked from commit 0963c11af8)
2024-04-26 12:15:52 -07:00
yuanhecai
5570d846ea loongarch: Delete the configuration of the compilation option "mlasx"
(cherry picked from commit 75340b827d)
2024-04-25 20:33:53 -07:00
Anonymous Maarten
f5dcb8f7ad stdinc: modify default alloca prototype
For compatibilty with TinyCC.

Backport of 06758685a5

(cherry picked from commit 9216b7a5ee)
2024-04-25 21:39:23 +03:00
Sam Lantinga
f6f1b09b69 Fixed build error (thanks @sezero!)
(cherry picked from commit ac5a61cd60)
(cherry picked from commit 67c60e0b9c)
2024-04-25 09:45:52 -07:00
Tyson Whitehead
bf540985aa Avoid opening non-joystick devices if possible to speedup scanning
Closing a device file takes 0.01 to 0.5s, which can add up to
significant startup delays. The udev classification does not
require opening the actual device files, so, use it if possible,
and only fall back to opening the device and probing otherwise.

(cherry picked from commit 45b804c158)
2024-04-25 08:48:57 -07:00
Frank Praznik
c39f86c28a x11: Fix pointer warp on XWayland
XWayland seems to require that the pointer be hidden when it is warped, so hide and show the pointer when warping, if required.

Note that XWayland still only allows warping within the window, so attempts to warp to global coordinates outside the window won't work.

(cherry picked from commit a845c7027e)
(cherry picked from commit 863d4a0f2a)
2024-04-25 08:42:04 -07:00
Sam Lantinga
b5da8ad00d Fixed Win+V handling (pasting from clipboard history) on Windows (thanks @ocornut!)
Fixes https://github.com/libsdl-org/SDL/issues/9613

(cherry picked from commit 33af02ae68)
2024-04-24 09:24:41 -07:00
Ozkan Sezer
f62b86263a CI, macOS: install autoconf.
Reference issue: https://github.com/libsdl-org/SDL/issues/9606 .

(cherry picked from commit 26e3d65ea8)
2024-04-24 00:39:00 +03:00
yassineimounachen
3449c734d5 Add USB IDs for the Thrustmaster TS-XW racing wheel
To be of use, this depends on https://github.com/berarma/oversteer/pull/200 and https://github.com/Kimplul/hid-tmff2/pull/94.

(cherry picked from commit 5ffb2f47d1)
(cherry picked from commit 8f18e2f52d)
2024-04-22 11:36:52 -07:00
Sam Lantinga
3f29d985fe Fixed compilation with C89 (thanks @d-s-a!)
Closes https://github.com/libsdl-org/SDL/pull/9564

(cherry picked from commit 4e29be814e)
2024-04-17 07:50:28 -07:00
Clownacy
2f4a7bbced Fix default Windows window icon not suiting the DPI.
For whatever reason, `ExtractIconEx` returns icons whose sizes are
inappropriate for the current DPI, resulting in terribly-blurry
window icons at higher DPIs.

To solve this, the window icon is now set to the first icon group
that is present in the executable. This behaviour should match what
Explorer does. By selecting an icon group instead of a specific icon,
Windows is free to select the icon within the group that best suits
the current DPI.

(cherry picked from commit 1fa6142903)
2024-04-02 12:05:09 -07:00
Zhuoran
a0522e4c21 Fix Caps Lock and Backspace mapping for Colemak
(cherry picked from commit 906ad64d7b)
2024-04-02 07:49:41 -07:00
Sam Lantinga
f461d91cd2 Updated to version 2.30.2 for release 2024-04-01 16:56:15 -07:00
Brian Collins
ef54e0c4f4 Workaround a macOS cursor-related bug.
This fixes an macOS bug that is only known to occur in fullscreen windows on the built-in displays of newer MacBooks with camera notches. When the mouse is moved near the top of such a window (within about 44 units) and then moved back down, the cursor rects aren't respected. This can cause the default cursor to be visible when it should not be.

(cherry picked from commit f1690e265e)
2024-04-01 16:22:03 -07:00
Ryan C. Gordon
863f39fb9f psp: Fixed building with pspdev when not using CMake.
(psp-cmake defines `__PSP__` on the command line, but the compiler itself
only defines `__psp__` and some variations.

Fixes #9378.

(cherry picked from commit 0d8ce4a761)
2024-03-28 09:48:03 -04:00
Sam Lantinga
d33b28c9fe Don't fail joystick initialization if udev isn't available
(cherry picked from commit 5fff9bc1e3)
2024-03-25 12:55:50 -07:00
Ozkan Sezer
c15a87a614 remove non-existent vulkan.hpp and vulkan_mir.h from Xcode project
(cherry picked from commit 358a80a473)
2024-03-25 22:02:40 +03:00
Anonymous Maarten
45de0635ac VisualC: remove vulkan.hpp
(cherry picked from commit eb185e8d88)
2024-03-25 22:02:20 +03:00
Alynne
bca314c339 Add Yawman Arrow flightstick controller
(cherry picked from commit 2b4c75690c)
(cherry picked from commit cbc9bd9804)
2024-03-25 06:36:09 -07:00
Tyson Whitehead
f05490d0e2 udev: Fix O(n^2) device walking issue (closes #9092)
I believe there was a O(n^2) device walking issues on startup

- MaybeAddDevice gets called for every device at startup
- MaybeAddDevice calls IsJoystick
- IsJoystick calls SDL_UDEV_GetProductInfo
- SDL_UDEV_GetProductInfo calls udev_enumerate_scan_devices
- udev_enumerate_scan_devices walks all the devices

Prior to commit 3b1e0e1 this was mostly masked as IsJoystick only
called SDL_UDEV_GetProductInfo when a JSIOCGNAME ioctl was
successful. This fixes the O(n^2) behaviour by directly getting
the device via udev_device_new_from_devnum (based on type, major,
and minor number) instead of enumerating everything via
udev_enumerate_scan_devices and matching on name.

(cherry picked from commit 6e1611cc77)
2024-03-24 11:49:50 -07:00
Sylvain
442e201705 Fix bug #9331 - SDL3 Android crash getVibrator() == null
(cherry picked from commit 1855ce68af)
(cherry picked from commit 763d768f7d)
2024-03-23 16:32:17 -07:00
Marcel Hild
9c346b2321 Add support for MadCatz Saitek Side Panel Control Deck
Signed-off-by: Marcel Hild <hild@b4mad.net>
(cherry picked from commit 67e425bcf8)
(cherry picked from commit fa18c9bf4a)
2024-03-22 09:16:39 -07:00
Frank Praznik
a6b684d05a wayland: Check the returned display pointer before dereferencing
Fixes a crash when all displays are disconnected.

(cherry picked from commit 5df737bb3c)
2024-03-20 15:45:58 -04:00
Sam Lantinga
8fb82da226 Poll for the initial controller state when using DirectInput
This fixes getting a deflected axis as the first buffered input reading on a generic USB controller (G-Shark GS-GP702)

(cherry picked from commit 70b0d33106)
(cherry picked from commit a9ac349846)
2024-03-20 10:42:39 -07:00
Pierre Wendling
0949f89028 N3DS: Fix locale name and early return.
- The name for simplified Chinese should be `zh_CN`.
- Ensure `cfguExit` is called even if `CFGU_GetSystemLanguage` failed.

(cherry picked from commit 390fff4ae0)
(cherry picked from commit 4a79fe44ff)
2024-03-19 16:54:46 -07:00
rofl0r
350a49e1cc PSP/Joystick: fix formatting
(cherry picked from commit c17d2246fb)
2024-03-17 13:24:12 -07:00
rofl0r
bc19e38728 PSP: don't block on joystick event query
using the blocking sceCtrlReadBufferPositive() effectively turns SDL_PollEvent() into WaitForVblank(), because the functions does exactly that if no input is buffered.
due to this, calling SDL_PollEvent() once per frame averaged in 7 ms delay out of the available 16ms budget to get a frame calculated and drawn to achieve 60 fps.

(cherry picked from commit 86f223d664)
2024-03-17 13:24:11 -07:00
Sam Lantinga
228a2954d7 Added a mapping for the Defender Joystick Cobra R4 (thanks @kotenok2000!)
(cherry picked from commit d972244d3a)
(cherry picked from commit 2d6c100058)
2024-03-17 12:15:38 -07:00
Sam Lantinga
3d6d4ca2cd Use the CRC as part of the unique key for mappings
(cherry picked from commit 4697153d1e)
(cherry picked from commit 07f04bb35e)
2024-03-17 12:15:31 -07:00
Frank Praznik
4c3e5cf1d1 wayland: Always use the entire buffer for the viewport source
Not doing so can result in protocol errors if the viewport source region is updated and a buffer with the old, smaller dimensions is committed.

(cherry picked from commit 24aedc1439)
2024-03-17 10:48:07 -04:00
Frank Praznik
27b1b6d4eb Add checks for memfd_create() and posix_fallocate() to the autotools build
(cherry picked from commit 59d4a39456)
2024-03-13 11:45:41 -04:00
Frank Praznik
24269007d8 Fix build (C90 declaration order)
(cherry picked from commit 88bdc028ec)
2024-03-12 21:17:29 -07:00
Frank Praznik
d849036927 wayland: Allocate the cursor shared memory buffer entirely in memory, if possible.
Use memfd_create() to allocate the temporary SHM backing file in memory, and set the size with posix_fallocate(), which will return an error on insufficient space vs ftruncate(), which will silently succeed and allow a SIGBUS error to occur if the unbacked memory is accessed.

Additionally, make the legacy path more robust by unlinking the temp file, so it won't persist after close, and unmapping the shared memory buffer.

(cherry picked from commit 9bdb992925)
(cherry picked from commit d3c89bb479)
2024-03-12 21:17:29 -07:00
Sam Lantinga
5be47255ba Removed incorrect mapping for a HORI controller
This broke support for the Hori Fighting Stick EX2, which gets a good mapping if the automatic mapping is allowed to create one.

If the original controller needs a mapping, it should be added with a crc, since that VID/PID combination is used by several HORI controllers.

(cherry picked from commit d79f865251)
(cherry picked from commit e54774faca)
2024-03-11 17:14:26 -07:00
Sam Lantinga
8f860b3698 Fixed crash if joystick functions are passed a NULL joystick
In particular this affects the doomsday game engine if no joystick or
gamepad is attached.

(cherry picked from commit 0dfdf1f3f2)
[smcv: Also included minor adjustment from https://github.com/libsdl-org/SDL/pull/9233]
(cherry picked from commit cd197be53b)
2024-03-09 08:41:16 -08:00
Sam Lantinga
35992597ae Added support for the 6-button SEGA Mega Drive Control Pad for Nintendo Online
(cherry picked from commit 528b71284f)
2024-03-08 13:08:27 -08:00
Sam Lantinga
3f0d7a2937 Fixed mapping for the Sanwa Supply JY-P76USV controller
(cherry picked from commit 57a160c9ab)
(cherry picked from commit 26054d9934)
2024-03-06 20:54:55 -08:00
Jade Macho
dae1232489 GDK: Partially revert 2670eb44af
MsgWaitForMultipleObjects is desktop-only.

(cherry picked from commit e1e5d33420)
(cherry picked from commit da9bfc43e7)
2024-03-06 21:28:24 +03:00
Ozkan Sezer
8e388843b8 SDL_RWFromFile, stdio: allow named pipes along with regular files.
Fixes https://github.com/libsdl-org/SDL/issues/9174

(cherry picked from commit 177a836653)
2024-03-06 18:50:28 +03:00
Sam Lantinga
5adbf3765a Updated to version 2.30.1 for release 2024-03-05 14:33:57 -08:00
Sam Lantinga
e910e6f13d Keep track of whether the Android on-screen keyboard was opened by the application
Fixes https://github.com/libsdl-org/SDL/issues/9202

(cherry picked from commit edbcef11ff)
(cherry picked from commit bdc7ad8f56)
2024-03-05 13:55:12 -08:00
Sam Lantinga
2f2cca8ac6 Added a mapping for the Sanwa Supply JY-P76USV controller
Fixes https://github.com/libsdl-org/SDL/issues/8644

(cherry picked from commit ccd309c433)
(cherry picked from commit d35dee76c7)
2024-03-03 12:24:15 -08:00
Sam Lantinga
a2f39399a1 SDL_GameControllerGetAppleSFSymbolsNameForAxis() returns NULL if the symbol isn't found
(cherry picked from commit 627e15871a)
2024-03-03 11:56:53 -08:00
Sam Lantinga
c1149f88b6 SDL_GameControllerGetAppleSFSymbolsNameForButton() returns NULL if the symbol isn't found
Fixes https://github.com/libsdl-org/SDL/issues/9071

(cherry picked from commit b87116ff03)
2024-03-03 11:13:04 -08:00
Sam Lantinga
54adba6a31 If the viewport changes the cliprect should be updated
The clip rectangle is defined to be viewport relative, so if the viewport changes we need to update it.

Fixes https://github.com/libsdl-org/SDL/issues/9094

(cherry picked from commit d0af01e7d4)
(cherry picked from commit 05f6709617)
2024-03-03 11:13:04 -08:00
Sam Lantinga
b48106f8a8 Don't test 10-bit pixel format conversion
We either need to explicitly test using the sRGB colorspace or update the tests for HDR10 color conversion. We'll just disable them for now, as these formats aren't commonly used in games.

(cherry picked from commit f9c57e16b0)
2024-03-03 00:01:20 +03:00
scribam
f345428367 ci: update deprecated node.js 16 actions
(cherry picked from commit 38d24778ed)
2024-02-23 23:42:56 +01:00
scribam
e4287595c1 ci: bump cross-platform-actions/action version to v0.23.0
(cherry picked from commit cbe330befd)
2024-02-23 23:21:40 +03:00
Sam Lantinga
73efbf2e14 Fixed Visual Studio warning 4459
(cherry picked from commit d135daad5b)
2024-02-21 23:33:28 +03:00
Ryan C. Gordon
ad342dfca9 audio: fix SSE conversion of Sint8 audio to Float32.
Fixes #9099.

(cherry picked from commit 4316c5ec02)
2024-02-21 15:16:46 -05:00
Sam Lantinga
f13d6d4b0f Convert mouse wheel coordinates to renderer view
Fixes https://github.com/libsdl-org/SDL/issues/9097

(cherry picked from commit 903d888cc3)
2024-02-20 15:45:04 -08:00
Frank Praznik
dfb8241317 wayland: Don't pass null string pointers to wl_cursor_theme_get_cursor
The function calls strcmp internally without checking for a null string parameter, and calling strcmp with a null parameter is undefined behavior.

(cherry picked from commit f24216c2ba)
2024-02-18 12:35:47 -05:00
Ryan C. Gordon
c67f10e43f x11: Cleaned up system cursor code to match previous Wayland change.
(cherry picked from commit df00a7dd4c)
2024-02-16 08:38:13 -05:00
Ryan C. Gordon
932eea513e wayland: Minor cleanup in new mouse cursor selection code.
- Move legacy name choice to a separate function, so we can `return` a
  string in one line instead of assign a variable and `break` for each item.
- Have the case statement cover SDL_NUM_SYSTEM_CURSORS, and not `default`, so
  compiler will (maybe) warn us if an enum value is added but not included here.
- Only choose a legacy name if necessary.

(cherry picked from commit 827917ea60)
2024-02-16 08:38:08 -05:00
Simon McVittie
5e51a37518 emscripten, wayland, x11: Share the table of CSS cursor names
As suggested in #8939.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 271df2fdd8)
2024-02-16 08:12:59 -05:00
Simon McVittie
372564299e emscripten, wayland, x11: Map SIZEALL to "all-scroll" instead of "move"
These previously mapped SIZEALL to "move", but "move" is not guaranteed
to be a four-pointed arrow: according to the CSS spec, it's actually
intended to be a drag-and-drop cursor, analogous to "alias" and "copy".
Map it to "all-scroll" instead, as in Wayland: while this is *also* not
semantically guaranteed to be a four-pointed arrow, it is at least
*suggested* to make it a four-pointed arrow.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit aa6c390bbd)
2024-02-16 08:12:54 -05:00
Ryan C. Gordon
c397fe0c51 wayland: Prefer to use CSS names for cursors, falling back to X11
SDL3's Wayland code already uses the CSS names exclusively with no
fallback, but since SDL2 has historically used the older names, keeping
them as a fallback makes sense if the CSS names don't work out.

[smcv: Added commit message]
Tested-by: Simon McVittie <smcv@collabora.com>

(cherry picked from commit 67827c0b00)
2024-02-16 08:12:47 -05:00
Simon McVittie
95227e2732 wayland: Use CSS/freedesktop cursor name "default" as a fallback
The "left_ptr" name is an X11 thing, and there's no guarantee that
Wayland cursor themes contain it. In particular, GNOME's Adwaita theme
as of version 46.beta only contains the CSS/freedesktop names.

To test, either move one of the known cursors out of the way, or edit
the switch statement above to use a wrong name for one of them.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit e2535ba547)
2024-02-16 08:12:41 -05:00
Ryan C. Gordon
6f8d6da77f x11: Use XcursorLibraryLoadCursor to load system cursors when available.
Apparently this is necessary on the latest Gnome to get properly themed
cursors, vs ancient X11 standard cursors, as Gnome has dropped the old
theme names that XCreateFontCursor eventually expected to find.

Fixes #8939.

(cherry picked from commit cb9565354c)
2024-02-16 02:13:30 -05:00
Ozkan Sezer
6f15aec644 don't let SDL_render.c:render_drivers[] have an empty initializer list.
(cherry picked from commit bc30fb295d)
2024-02-15 22:51:50 +03:00
Ozkan Sezer
9bed177f10 Check the SDL_VIDEO_RENDER_??? macros with #if instead of #ifdef
Allows users to disable them by defining them as 0.

Closes https://github.com/libsdl-org/SDL/issues/8996
(cherry picked from commit d0731ab9a3)
2024-02-15 22:51:37 +03:00
Frank Praznik
7de4f16710 wayland: Don't store wl_output pointers in mode driver data
They aren't used for anything, and cause problems if the video core tries to free them.

Manual backport of f9ba0e1

(cherry picked from commit 699cec1a8d)
2024-02-14 11:53:07 -05:00
Sam Lantinga
beac43f41f Revert "wayland: Don't initialize OpenGL when the window flags didn't specify it"
This reverts commit f522c5380c.

We don't want this change for SDL2, and we're doing further investigation for SDL3.

Fixes https://github.com/libsdl-org/SDL/issues/9035

(cherry picked from commit 120b8d4189)
2024-02-12 16:03:14 -08:00
Sam Lantinga
8538d5dcf1 Fixed error: unused variable 'axes' [-Werror,-Wunused-variable]
(cherry picked from commit 814a94c349)
(cherry picked from commit 6669d04ea6)
2024-02-12 11:18:54 -08:00
Sam Lantinga
0fb294ade4 Explicitly retain and release NSObjects in C structures
Fixes https://github.com/libsdl-org/SDL/issues/9021
Fixes https://github.com/libsdl-org/SDL/issues/9042

(cherry picked from commit 42cdbf6b21)
(cherry picked from commit 971c5c2610)
2024-02-12 10:21:59 -08:00
Chris Collins
0f6a682ea6 Wayland: Avoid SEGV if a modifier notification comes before the keymap
(cherry picked from commit 0f81598e9f)
(cherry picked from commit de0cb94e72)
2024-02-10 07:05:16 -08:00
Hans-Kristian Arntzen
c4fc20a033 Fix broken use of MsgWaitForMultipleObjects.
- Timeout < 0 was not handled properly
- Return value for success is WAIT_OBJECT_0 + nCount, not positive value

(cherry picked from commit 69f2bd151e)
(cherry picked from commit 4ae87e215e)
2024-02-10 07:03:21 -08:00
Sam Lantinga
a24e2bfc76 Guarded ElementAlreadyHandled with #ifdef ENABLE_PHYSICAL_INPUT_PROFILE (thanks @Donione!)
Fixes https://github.com/libsdl-org/SDL/issues/9033

(cherry picked from commit 3ebbf0f409)
(cherry picked from commit 646cccede7)
2024-02-09 16:13:14 -08:00
Sam Lantinga
6a83588fdd Redefine XINPUT_CAPABILITIES_EX as an SDL typedef
mingw-w64 has added this from Proton (which added this from SDL), so we need to re-define it as a local symbol to avoid conflicting with mingw-w64 headers.

Fixes https://github.com/libsdl-org/SDL/issues/9031

(cherry picked from commit b7c61569f8)
(cherry picked from commit 93d7b6e50c)
2024-02-09 01:28:48 -08:00
Sam Lantinga
0092b3629e Added VIDPID for OpenFFBoard wheel (thanks @groybe!)
Closes https://github.com/libsdl-org/SDL/pull/7987

(cherry picked from commit 26e947f8ea)
(cherry picked from commit 40b61b81f1)
2024-02-07 16:36:02 -08:00
pastdue
c0eedcd4ce Emscripten_SetWindowFullscreen: Fix crash due to uninitialized EmscriptenFullscreenStrategy members
(cherry picked from commit 7b74e2eeb8)
(cherry picked from commit d2a3347c19)
2024-02-06 16:27:36 -08:00
meyraud705
d1b6d5f33d Fix memory leak in SDL_UpdateSteamVirtualGamepadInfo()
(cherry picked from commit 82d89ff4fb)
(cherry picked from commit a09b0b05eb)
2024-02-06 01:56:41 -08:00
Wohlstand
fe297fc6d8 SDL_windowsopengl.c: WGL: Fixed null-pointer dereference crash
Fixes #8968

Fixed crash after 594a79c2f9

(cherry picked from commit a29f37c14a)
2024-02-03 06:19:26 -08:00
Wohlstand
384fcea585 SDL_audiotypecvt.c: Fixed memory corruption when resampling S16 t F32
(cherry picked from commit ca01016577)
2024-02-03 06:14:37 -08:00
Joshua Root
2f2b44a1bd Fix SDL_mfijoystick build issues
Add missing guards around use of physicalInputProfile.

Add explicit import of Foundation which seems to be needed on some
systems to get the NSArray definition.

Add __unsafe_unretained to ObjC types in struct so the compiler doesn't
complain about that not being allowed with ARC.

Closes: #8979
(cherry picked from commit e0158f68e4)
(cherry picked from commit c53c351921)
2024-02-02 22:25:49 -08:00
Sam Lantinga
8386daddcb vulkan_metal.h: Make compatible with ObjC ARC (thanks @jmroot!)
(re)Fixes #6598

We need to remember to apply this again once we update from upstream headers.

(cherry picked from commit e67e0c5d55)
(cherry picked from commit fc787a41dc)
2024-02-02 18:31:27 -08:00
Simon McVittie
739a23e506 testautomation_math: Fix misleading log output
These originally checked for expected ± EPSILON as logged, but since
commit 880c6939 they check for expected ± max_err, where max_err may
need to be greater than EPSILON for very large expected results like
the ones in exp_regularCases().

Also, EPSILON is so small that the default precision of the %f format
(6 decimal places) would never actually have shown its effect, so log
it in scientific notation instead.

Fixes: 880c6939 "testautomation_math: do relative comparison + more precise correct trigonometric values"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 58907d2c27)
2024-02-02 07:45:57 -08:00
Simon McVittie
5a59155a05 test: Don't accept results that are much less than expected
While looking at the other tests in this file, I noticed that instead
of checking for a result in the range of expected ± FLT_EPSILON as I
would have expected, these tests would accept any result strictly less
than expected + FLT_EPSILON, for example a wrong result that is very
large and negative. This is presumably not what was intended, so add
the SDL_fabs() that I assume was meant to be here.

Fixes: 474c8d00 "testautomation: don't do float equality tests"
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit a7bd18c0d5)
2024-02-02 07:45:57 -08:00
Simon McVittie
1ad917e2f6 testautomation: Don't expect exp to yield exact floating point results
In the Steam Runtime 1 'scout' environment, when compiling for i386
using the default gcc-4.6, Exp(34.125) matches the desired value to the
precision shown in the log (6 decimal places) but is not an exact match
for the desired value.

Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit f73abd49c3)
2024-02-02 07:45:57 -08:00
Sam Lantinga
859844eae3 Updated to version 2.30.0 for release 2024-02-01 16:02:20 -08:00
Sam Lantinga
857b9848d2 Don't use the system iconv on Apple mobile platforms
Fixes https://github.com/libsdl-org/SDL/issues/8964

(cherry picked from commit d6a48e4958)
(cherry picked from commit 8eed915dfa)
2024-02-01 15:55:20 -08:00
Sam Lantinga
5f98fcf00b Use the exact motion associated with the warp
When Windows DPI scaling is enabled, the warp coordinates will be modified, so make sure we send exactly the coordinates that the warp attempted.

Fixes https://github.com/libsdl-org/SDL/issues/8940

(cherry picked from commit 8ce6fb2513)
2024-01-30 11:13:44 -08:00
Francisco Javier Trujillo Mata
5a492e8196 Fixing viewport
(cherry picked from commit d34a7c5ed2)
2024-01-29 20:44:07 -08:00
Francisco Javier Trujillo Mata
80cb52c944 Fix scissor usage
(cherry picked from commit 36b8438280)
2024-01-29 20:44:07 -08:00
Francisco Javier Trujillo Mata
4436c09c9d Fix color
(cherry picked from commit faa8fc2917)
2024-01-29 20:44:07 -08:00
Ozkan Sezer
23cf7a2e0d autotools: a few libtool updates from mainstream
(cherry picked from commit 971508c0d7)
2024-01-28 21:50:42 +03:00
Sam Lantinga
4a62e1c0ca Updated to version 2.29.3 for RC build 2024-01-27 22:50:08 -08:00
Sam Lantinga
173afd8564 Fixed testautomation log callback calling convention
(cherry picked from commit 9f7eb6c4c1)
(cherry picked from commit c55bd24827)
2024-01-27 22:45:13 -08:00
Ryan C. Gordon
f6b9ebb838 wasapi: If GetDeviceBuf can't get a full buffer, go back to waiting.
Reference Issue #8924.

(cherry picked from commit f931b25f4c)
2024-01-28 00:23:40 -05:00
Ryan C. Gordon
f1b109005c aaudio: Backport headphone hotplugging support from SDL3.
Fixes #4985.

(cherry picked from commit ec25d6b1e8)
2024-01-28 00:20:34 -05:00
Sam Lantinga
0bd58cd727 Fixed Watcom build
(cherry picked from commit bb30a35364)
2024-01-27 20:29:06 -08:00
Sam Lantinga
de1292f8ac Fixed build
(cherry picked from commit 11c932bf1d)
2024-01-27 20:18:59 -08:00
Sam Lantinga
a6d5c1fe05 Added the environment variable SDL_LOGGING to control default log output
(cherry picked from commit 12bdb2b4d0)
(cherry picked from commit f0b8fee88f)
2024-01-27 19:46:59 -08:00
Sam Lantinga
fc5bd11dac Simplified the default log category logic
Now it's much clearer and easier to tweak the defaults

(cherry picked from commit 4fba663368)
(cherry picked from commit 6ec3f5a28e)
2024-01-27 19:46:59 -08:00
Sam Lantinga
e767840874 Document that the default log priority is error, not critical
(cherry picked from commit a7a98d8bbb)
(cherry picked from commit 2c11068569)
2024-01-27 19:46:58 -08:00
Ozkan Sezer
fd08ca3823 SDL_rwops.c (SDL_IsRegularFile): fix WinRT build failure due to S_ISREG
(cherry picked from commit fcd1c155cc)
2024-01-28 02:21:01 +03:00
Ozkan Sezer
3bf60755cb SDL_RWFromFile, stdio: reject if the file is not a regular file.
Fixes https://github.com/libsdl-org/SDL/issues/8935
(cherry picked from commit 230ae797a7)
2024-01-28 01:45:10 +03:00
Sam Lantinga
aac7d1c2ae Report out of memory instead of crashing in SDL_LoadFile_RW()
Fixes https://github.com/libsdl-org/SDL/issues/8935

(cherry picked from commit 5297596132)
2024-01-27 12:17:04 -08:00
Sam Lantinga
55caed2011 Fixed N3DS build
(cherry picked from commit 332213163c)
2024-01-27 11:56:51 -08:00
Sam Lantinga
53058af284 Enable text input on video initialization without popping up an on-screen keyboard
Fixes https://github.com/libsdl-org/SDL/issues/8561

(cherry picked from commit 4ff3b28273)
2024-01-27 11:54:50 -08:00
Ryan C. Gordon
ad1a11164c wasapi: Clamp device->spec.samples to the hardware buffer size.
Reference Issue #8924.
2024-01-26 13:58:38 -05:00
Ryan C. Gordon
5f6a4fe643 blendmode: Corrected docs for SDL_BLENDOPERATION_[REV_]SUBTRACT.
They were documented backwards.

Fixes #8910.

(cherry picked from commit ecbbef8b8d)
2024-01-25 17:49:55 -05:00
Sam Lantinga
c85ea238ca Improved timing accuracy of SDL_WaitEventTimeout() on Windows
We don't need to use the hack of setting a timer and waiting for a timer message, MsgWaitForMultipleObjects() will allow us to wait for input directly with a timeout.

Before this change, sleeping for 20 ms would actually sleep for around 30 ms, with this change the sleep time is pretty accurate at 20-21 ms.

(cherry picked from commit 2670eb44af)
(cherry picked from commit 08caafe2f1)
2024-01-25 06:37:34 -08:00
Ningyuan Li
5c0b2d04f4 mayflash adapter PS4 support
(cherry picked from commit d6ebbc2fa4)
(cherry picked from commit 138fe3d43d)
2024-01-24 19:26:44 -08:00
Sam Lantinga
76e64053c3 Make sure we include the matching copy of vk_video headers
(cherry picked from commit 1ac9602909)
(cherry picked from commit b16ef14c7c)
2024-01-24 09:42:22 -08:00
Sam Lantinga
ddfa59a52b Update to the latest version of the Khronos headers
(cherry picked from commit fc74bf8455)
(cherry picked from commit 0f5a815657)
2024-01-24 09:42:22 -08:00
Sam Lantinga
e3fb974fc7 Fixed ambiguity between std::byte and byte in rpcndr.h
Fixes https://github.com/libsdl-org/SDL/issues/8911

(cherry picked from commit a71f99c71f)
(cherry picked from commit 9196584773)
2024-01-23 09:05:29 -08:00
Ozkan Sezer
9120fbd501 make video/pandora to actually compile somehow.
no one ever maintained it for years..
(cherry picked from commit 48b62e2e57)
2024-01-23 17:50:20 +03:00
Ozkan Sezer
52181848da fixes after ShowMessageBox changes:
- SDL_video.c (SDL_ShowMessageBox): remove C99'ism.
- SDL_os2video.c (OS2DIVE_bootstrap): add OS2_ShowMessageBox
- SDL_os2video.c (OS2VMAN_bootstrap): add OS2_ShowMessageBox
- SDL_DirectFB_video.c (DirectFB_bootstrap): NULL ShowMessageBox
- SDL_naclvideo.c (NACL_bootstrap): NULL ShowMessageBox
(cherry picked from commit 9e352e61db)
2024-01-23 04:12:32 +03:00
Ryan C. Gordon
10cbe04fc5 SDL_ShowMessageBox: Remove #ifdefs and respect SDL_VIDEO_DRIVER hint.
Fixes #8892.

(cherry picked from commit c5c0b2cb34)
2024-01-22 19:46:23 -05:00
Ryan C. Gordon
8367b00e8c aaudio: Set low-latency audio mode.
Note that apparently this has caused some weird-sounding audio
on some Android devices, so we might wrap this in a hint later,
or try to check for specific devices.

Fixes #8888.

(cherry picked from commit 1e016fd5ea)
2024-01-22 18:28:10 -05:00
Ozkan Sezer
4a4f289adc testhaptic.c: include stdlib.h for exit()
(cherry picked from commit aaf426e280)
2024-01-23 01:20:40 +03:00
Frank Praznik
467f1d52e4 wayland: Always create the backing input store, even if there is no seat
Fixes a crash if no seat was available at initialization, but still allows for one to still be created later if an input device is added.

Manual backport of 84e47b4

(cherry picked from commit a8eeb181b6)
2024-01-22 13:02:58 -05:00
1163 changed files with 10975 additions and 17461 deletions

View File

@@ -28,6 +28,7 @@ class JobOs(Enum):
WindowsLatest = "windows-latest" WindowsLatest = "windows-latest"
UbuntuLatest = "ubuntu-latest" UbuntuLatest = "ubuntu-latest"
MacosLatest = "macos-latest" MacosLatest = "macos-latest"
Ubuntu20_04 = "ubuntu-20.04"
Ubuntu22_04 = "ubuntu-22.04" Ubuntu22_04 = "ubuntu-22.04"
Ubuntu24_04 = "ubuntu-24.04" Ubuntu24_04 = "ubuntu-24.04"
Macos13 = "macos-13" Macos13 = "macos-13"
@@ -50,18 +51,19 @@ class SdlPlatform(Enum):
Riscos = "riscos" Riscos = "riscos"
FreeBSD = "freebsd" FreeBSD = "freebsd"
NetBSD = "netbsd" NetBSD = "netbsd"
OpenBSD = "openbsd"
Watcom = "watcom" Watcom = "watcom"
class Msys2Platform(Enum): class Msys2Platform(Enum):
Mingw32 = "mingw32" Mingw32 = "mingw32"
Mingw64 = "mingw64" Mingw64 = "mingw64"
Clang32 = "clang32"
Clang64 = "clang64" Clang64 = "clang64"
Ucrt64 = "ucrt64" Ucrt64 = "ucrt64"
class IntelCompiler(Enum): class IntelCompiler(Enum):
Icc = "icc"
Icx = "icx" Icx = "icx"
@@ -105,21 +107,24 @@ class JobSpec:
JOB_SPECS = { JOB_SPECS = {
"msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ), "msys2-mingw32": JobSpec(name="Windows (msys2, mingw32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32", msys2_platform=Msys2Platform.Mingw32, ),
"msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ), "msys2-mingw64": JobSpec(name="Windows (msys2, mingw64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64", msys2_platform=Msys2Platform.Mingw64, ),
"msys2-clang32": JobSpec(name="Windows (msys2, clang32)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw32-clang", msys2_platform=Msys2Platform.Clang32, ),
"msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ), "msys2-clang64": JobSpec(name="Windows (msys2, clang64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-clang", msys2_platform=Msys2Platform.Clang64, ),
"msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ), "msys2-ucrt64": JobSpec(name="Windows (msys2, ucrt64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msys2, artifact="SDL-mingw64-ucrt", msys2_platform=Msys2Platform.Ucrt64, ),
"msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ), "msvc-x64": JobSpec(name="Windows (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_project="VisualC/SDL.sln", ),
"msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ), "msvc-x86": JobSpec(name="Windows (MSVC, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_project="VisualC/SDL.sln", ),
"msvc-static-x86": JobSpec(name="Windows (MSVC, static VCRT, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_static_crt=True, ), "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"msvc-static-x64": JobSpec(name="Windows (MSVC, static VCRT, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_static_crt=True, ), "msvc-static-x64": JobSpec(name="Windows (MSVC, static VCRT, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x64", msvc_arch=MsvcArch.X64, msvc_static_crt=True, ),
"msvc-static-x86": JobSpec(name="Windows (MSVC, static VCRT, x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-x86", msvc_arch=MsvcArch.X86, msvc_static_crt=True, ),
"msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ), "msvc-clang-x64": JobSpec(name="Windows (MSVC, clang-cl x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x64", msvc_arch=MsvcArch.X64, clang_cl=True, ),
"msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ),
"msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ),
"msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ),
"msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), "msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ),
"msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ),
"ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", autotools=True),
"ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", autotools=True), "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", autotools=True),
"steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ), "steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ),
"ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ), "ubuntu-intel-icx": JobSpec(name="Ubuntu 20.04 (Intel oneAPI)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-oneapi", intel=IntelCompiler.Icx, ),
"ubuntu-intel-icc": JobSpec(name="Ubuntu 20.04 (Intel Compiler)", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04-icc", intel=IntelCompiler.Icc, ),
"macos-gnu-arm64-x64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-x64-gnu",autotools=True, apple_archs={AppleArch.X86_64, AppleArch.ARM64, }, ), "macos-gnu-arm64-x64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-x64-gnu",autotools=True, apple_archs={AppleArch.X86_64, AppleArch.ARM64, }, ),
"ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ), "ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ),
"tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ), "tvos": JobSpec(name="tvOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Tvos, artifact="SDL-tvos-arm64", xcode=True, ),
@@ -134,7 +139,6 @@ JOB_SPECS = {
"vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ), "vita-pvr": JobSpec(name="Sony PlayStation Vita (GLES w/ PVR_PSP2)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Vita, artifact="SDL-vita-pvr", container="vitasdk/vitasdk:latest", vita_gles=VitaGLES.Pvr, ),
"riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ), "riscos": JobSpec(name="RISC OS", os=JobOs.UbuntuLatest, platform=SdlPlatform.Riscos, artifact="SDL-riscos", container="riscosdotinfo/riscos-gccsdk-4.7:latest", ),
"netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", autotools=True, ), "netbsd": JobSpec(name="NetBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.NetBSD, artifact="SDL-netbsd-x64", autotools=True, ),
"openbsd": JobSpec(name="OpenBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.OpenBSD, artifact="SDL-openbsd-x64", autotools=True, ),
"freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", autotools=True, ), "freebsd": JobSpec(name="FreeBSD", os=JobOs.UbuntuLatest, platform=SdlPlatform.FreeBSD, artifact="SDL-freebsd-x64", autotools=True, ),
"watcom-win32": JobSpec(name="Watcom (Windows)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.Windows ), "watcom-win32": JobSpec(name="Watcom (Windows)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.Windows ),
"watcom-os2": JobSpec(name="Watcom (OS/2)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.OS2 ), "watcom-os2": JobSpec(name="Watcom (OS/2)", os=JobOs.WindowsLatest, platform=SdlPlatform.Watcom, artifact="SDL-watcom-win32", no_cmake=True, watcom_platform=WatcomPlatform.OS2 ),
@@ -177,7 +181,6 @@ class JobDetails:
brew_packages: list[str] = dataclasses.field(default_factory=list) brew_packages: list[str] = dataclasses.field(default_factory=list)
cmake_toolchain_file: str = "" cmake_toolchain_file: str = ""
cmake_arguments: list[str] = dataclasses.field(default_factory=list) cmake_arguments: list[str] = dataclasses.field(default_factory=list)
cmake_generator: str = "Ninja"
cmake_build_arguments: list[str] = dataclasses.field(default_factory=list) cmake_build_arguments: list[str] = dataclasses.field(default_factory=list)
cppflags: list[str] = dataclasses.field(default_factory=list) cppflags: list[str] = dataclasses.field(default_factory=list)
cc: str = "" cc: str = ""
@@ -223,7 +226,6 @@ class JobDetails:
setup_vita_gles_type: str = "" setup_vita_gles_type: str = ""
check_sources: bool = False check_sources: bool = False
watcom_makefile: str = "" watcom_makefile: str = ""
binutils_strings: str = "strings"
def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]: def to_workflow(self, enable_artifacts: bool) -> dict[str, str|bool]:
data = { data = {
@@ -257,7 +259,6 @@ class JobDetails:
"cflags": my_shlex_join(self.cppflags + self.cflags), "cflags": my_shlex_join(self.cppflags + self.cflags),
"cxxflags": my_shlex_join(self.cppflags + self.cxxflags), "cxxflags": my_shlex_join(self.cppflags + self.cxxflags),
"ldflags": my_shlex_join(self.ldflags), "ldflags": my_shlex_join(self.ldflags),
"cmake-generator": self.cmake_generator,
"cmake-toolchain-file": self.cmake_toolchain_file, "cmake-toolchain-file": self.cmake_toolchain_file,
"cmake-arguments": my_shlex_join(self.cmake_arguments), "cmake-arguments": my_shlex_join(self.cmake_arguments),
"cmake-build-arguments": my_shlex_join(self.cmake_build_arguments), "cmake-build-arguments": my_shlex_join(self.cmake_build_arguments),
@@ -290,7 +291,6 @@ class JobDetails:
"setup-gdk-folder": self.setup_gdk_folder, "setup-gdk-folder": self.setup_gdk_folder,
"check-sources": self.check_sources, "check-sources": self.check_sources,
"watcom-makefile": self.watcom_makefile, "watcom-makefile": self.watcom_makefile,
"binutils-strings": self.binutils_strings,
} }
return {k: v for k, v in data.items() if v != ""} return {k: v for k, v in data.items() if v != ""}
@@ -344,6 +344,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
case IntelCompiler.Icx: case IntelCompiler.Icx:
job.cc = "icx" job.cc = "icx"
job.cxx = "icpx" job.cxx = "icpx"
case IntelCompiler.Icc:
job.cc = "icc"
job.cxx = "icpc"
job.cppflags.append("-diag-disable=10441")
case _: case _:
raise ValueError(f"Invalid intel={spec.intel}") raise ValueError(f"Invalid intel={spec.intel}")
job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;" job.source_cmd = f"source /opt/intel/oneapi/setvars.sh;"
@@ -380,9 +384,11 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
match spec.msvc_arch: match spec.msvc_arch:
case MsvcArch.X86: case MsvcArch.X86:
job.cflags.append("/clang:-m32") job.cflags.append("/clang:-m32")
job.cxxflags.append("/clang:-m32")
job.ldflags.append("/MACHINE:X86") job.ldflags.append("/MACHINE:X86")
case MsvcArch.X64: case MsvcArch.X64:
job.cflags.append("/clang:-m64") job.cflags.append("/clang:-m64")
job.cxxflags.append("/clang:-m64")
job.ldflags.append("/MACHINE:X64") job.ldflags.append("/MACHINE:X64")
case _: case _:
raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})") raise ValueError(f"Unsupported clang-cl architecture (arch={spec.msvc_arch})")
@@ -606,14 +612,11 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
job.shared_lib = SharedLibType.SO_0 job.shared_lib = SharedLibType.SO_0
job.static_lib = StaticLibType.A job.static_lib = StaticLibType.A
case SdlPlatform.N3ds: case SdlPlatform.N3ds:
job.cmake_generator = "Unix Makefiles"
job.cmake_build_arguments.append("-j$(nproc)")
job.shared = False job.shared = False
job.apt_packages = [] job.apt_packages = ["ninja-build", "binutils"]
job.run_tests = False job.run_tests = False
job.cc_from_cmake = True job.cc_from_cmake = True
job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake" job.cmake_toolchain_file = "${DEVKITPRO}/cmake/3DS.cmake"
job.binutils_strings = "/opt/devkitpro/devkitARM/bin/arm-none-eabi-strings"
job.static_lib = StaticLibType.A job.static_lib = StaticLibType.A
case SdlPlatform.Msys2: case SdlPlatform.Msys2:
job.shell = "msys2 {0}" job.shell = "msys2 {0}"
@@ -626,7 +629,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
"clang64": "mingw-w64-clang-x86_64", "clang64": "mingw-w64-clang-x86_64",
"ucrt64": "mingw-w64-ucrt-x86_64", "ucrt64": "mingw-w64-ucrt-x86_64",
}[spec.msys2_platform.value] }[spec.msys2_platform.value]
job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, ) job.msys2_no_perl = spec.msys2_platform in (Msys2Platform.Mingw32, Msys2Platform.Clang32)
job.shared_lib = SharedLibType.WIN32 job.shared_lib = SharedLibType.WIN32
job.static_lib = StaticLibType.A job.static_lib = StaticLibType.A
case SdlPlatform.Riscos: case SdlPlatform.Riscos:
@@ -645,7 +648,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
)) ))
job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake" job.cmake_toolchain_file = "/home/riscos/env/toolchain-riscos.cmake"
job.static_lib = StaticLibType.A job.static_lib = StaticLibType.A
case SdlPlatform.FreeBSD | SdlPlatform.NetBSD | SdlPlatform.OpenBSD: case SdlPlatform.FreeBSD | SdlPlatform.NetBSD:
job.build_autotools_tests = False job.build_autotools_tests = False
job.cpactions = True job.cpactions = True
job.no_cmake = True job.no_cmake = True
@@ -656,7 +659,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
match spec.platform: match spec.platform:
case SdlPlatform.FreeBSD: case SdlPlatform.FreeBSD:
job.cpactions_os = "freebsd" job.cpactions_os = "freebsd"
job.cpactions_version = "14.2" job.cpactions_version = "13.3"
job.cpactions_arch = "x86-64" job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg update" job.cpactions_setup_cmd = "sudo pkg update"
job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd" job.cpactions_install_cmd = "sudo pkg install -y cmake ninja pkgconf libXcursor libXext libXinerama libXi libXfixes libXrandr libXScrnSaver libXxf86vm wayland wayland-protocols libxkbcommon mesa-libs libglvnd evdev-proto libinotify alsa-lib jackit pipewire pulseaudio sndio dbus zh-fcitx ibus libudev-devd"
@@ -666,16 +669,10 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
)) ))
case SdlPlatform.NetBSD: case SdlPlatform.NetBSD:
job.cpactions_os = "netbsd" job.cpactions_os = "netbsd"
job.cpactions_version = "10.1" job.cpactions_version = "10.0"
job.cpactions_arch = "x86-64" job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update" job.cpactions_setup_cmd = "export PATH=\"/usr/pkg/sbin:/usr/pkg/bin:/sbin:$PATH\"; export PKG_CONFIG_PATH=\"/usr/pkg/lib/pkgconfig\";export PKG_PATH=\"https://cdn.netBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f \"1 2\" -d.)/All/\";echo \"PKG_PATH=$PKG_PATH\";echo \"uname -a -> \"$(uname -a)\"\";sudo -E sysctl -w security.pax.aslr.enabled=0;sudo -E sysctl -w security.pax.aslr.global=0;sudo -E pkgin clean;sudo -E pkgin update"
job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1" job.cpactions_install_cmd = "sudo -E pkgin -y install cmake dbus pkgconf ninja-build pulseaudio libxkbcommon wayland wayland-protocols libinotify libusb1"
case SdlPlatform.OpenBSD:
job.cpactions_os = "openbsd"
job.cpactions_version = "7.4"
job.cpactions_arch = "x86-64"
job.cpactions_setup_cmd = "sudo pkg_add -u"
job.cpactions_install_cmd = "sudo pkg_add cmake ninja pkgconf wayland wayland-protocols xwayland libxkbcommon libinotify pulseaudio dbus ibus"
case SdlPlatform.Watcom: case SdlPlatform.Watcom:
match spec.watcom_platform: match spec.watcom_platform:
case WatcomPlatform.OS2: case WatcomPlatform.OS2:

View File

@@ -177,7 +177,7 @@ jobs:
#shell: ${{ matrix.platform.shell }} #shell: ${{ matrix.platform.shell }}
run: | run: |
${{ matrix.platform.source-cmd }} ${{ matrix.platform.source-cmd }}
${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -G "${{ matrix.platform.cmake-generator }}" \ ${{ matrix.platform.cmake-config-emulator }} cmake -S . -B build -GNinja \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \ ${{ matrix.platform.cmake-toolchain-file != '' && format('-DCMAKE_TOOLCHAIN_FILE={0}', matrix.platform.cmake-toolchain-file) || '' }} \
-DSDL_WERROR=${{ matrix.platform.werror }} \ -DSDL_WERROR=${{ matrix.platform.werror }} \
@@ -207,9 +207,9 @@ jobs:
run: | run: |
echo "This should show us the SDL_REVISION" echo "This should show us the SDL_REVISION"
echo "Shared library:" echo "Shared library:"
${{ (matrix.platform.shared-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }} ${{ (matrix.platform.shared-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.shared-lib)) || 'echo "<Shared library not supported by platform>"' }}
echo "Static library:" echo "Static library:"
${{ (matrix.platform.static-lib && format('{0} build/{1} | grep "Github Workflow"', matrix.platform.binutils-strings, matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }} ${{ (matrix.platform.static-lib && format('strings build/{0} | grep "Github Workflow"', matrix.platform.static-lib)) || 'echo "<Static library not supported by platform>"' }}
- name: 'Run build-time tests (CMake)' - name: 'Run build-time tests (CMake)'
id: cmake-tests id: cmake-tests
if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }} if: ${{ !matrix.platform.no-cmake && matrix.platform.run-tests }}
@@ -264,11 +264,11 @@ jobs:
- name: 'Build (cross-platform-actions, BSD)' - name: 'Build (cross-platform-actions, BSD)'
id: cpactions id: cpactions
if: ${{ matrix.platform.cpactions }} if: ${{ matrix.platform.cpactions }}
uses: cross-platform-actions/action@v0.27.0 uses: cross-platform-actions/action@v0.25.0
with: with:
operating_system: '${{ matrix.platform.cpactions-os }}' operating_system: ${{ matrix.platform.cpactions-os }}
architecture: '${{ matrix.platform.cpactions-arch }}' architecture: ${{ matrix.platform.cpactions-arch }}
version: '${{ matrix.platform.cpactions-version }}' version: ${{ matrix.platform.cpactions-version }}
run: | run: |
${{ matrix.platform.cpactions-setup-cmd }} ${{ matrix.platform.cpactions-setup-cmd }}
${{ matrix.platform.cpactions-install-cmd }} ${{ matrix.platform.cpactions-install-cmd }}

View File

@@ -181,7 +181,7 @@ jobs:
msvc: msvc:
needs: [src] needs: [src]
runs-on: windows-2025 runs-on: windows-2019
outputs: outputs:
VC-x86: ${{ steps.releaser.outputs.VC-x86 }} VC-x86: ${{ steps.releaser.outputs.VC-x86 }}
VC-x64: ${{ steps.releaser.outputs.VC-x64 }} VC-x64: ${{ steps.releaser.outputs.VC-x64 }}

2
.gitignore vendored
View File

@@ -15,7 +15,7 @@ build
gen gen
Build Build
buildbot buildbot
/REVISION.txt /VERSION.txt
dist dist
*.so *.so

View File

@@ -1,9 +1,9 @@
projectfullname = Simple Directmedia Layer projectfullname = SDL2
projectshortname = SDL projectshortname = SDL2
incsubdir = include incsubdir = include
wikisubdir = SDL2 wikisubdir = SDL2
readmesubdir = docs readmesubdir = docs
apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_|[US]int\d+) apiprefixregex = (SDL_|SDLK_|KMOD_|AUDIO_)
mainincludefname = SDL.h mainincludefname = SDL.h
versionfname = include/SDL_version.h versionfname = include/SDL_version.h
versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z versionmajorregex = \A\#define\s+SDL_MAJOR_VERSION\s+(\d+)\Z
@@ -14,19 +14,4 @@ projecturl = https://libsdl.org/
wikiurl = https://wiki.libsdl.org/SDL2 wikiurl = https://wiki.libsdl.org/SDL2
bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new bugreporturl = https://github.com/libsdl-org/sdlwiki/issues/new
warn_about_missing = 0 warn_about_missing = 0
#wikipreamble = (This is the legacy documentation for SDL2, the previous stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current stable version.) wikipreamble = (This is the legacy documentation for stable SDL2, the current stable version; [SDL3](https://wiki.libsdl.org/SDL3/) is the current development version.)
wikiheaderfiletext = Defined in [%fname%](https://github.com/libsdl-org/SDL/blob/SDL2/include/%fname%)
manpageheaderfiletext = Defined in %fname%
# All SDL_config_*.h headers are uncategorized, in case something slips in from them.
# All SDL_test_* headers become uncategorized, 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.
headercategoryeval = s/\ASDL_config_.*?\.h\Z//; s/\ASDL_test_.*?\.h\Z//; s/\ASDL_?(.*?)\.h\Z/$1/; ucfirst();
# !!! FIXME: maybe later, but there are probably documentation gaps to fix first.
quickrefenabled = 0
quickrefcategoryorder = Init,Hints,Error,Version,Properties,Log,Video,Events,Keyboard,Mouse,Touch,Gesture,GameController,Joystick,Haptic,Audio,Timer,Render,LoadSO,Thread,Mutex,Atomic,Filesystem,RWOPS,Pixels,Surface,Blendmode,Rect,Clipboard,Messagebox,Vulkan,Metal,Platform,Power,Sensor,Bits,Endian,Assert,CPUInfo,Locale,System,Misc,GUID,Main,Stdinc
quickreftitle = SDL2 API Quick Reference
quickrefurl = https://libsdl.org/
quickrefdesc = The latest version of this document can be found at https://wiki.libsdl.org/SDL2/QuickReference
quickrefmacroregex = \A(SDL_Atomic...Ref|SDL_assert.*?|SDL_arraysize|SDL_Swap[BL]E\d\d|SDL_[a-z]+_cast|SDL_Load...)\Z

View File

@@ -35,7 +35,6 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/hidapi/android/*.cpp) \ $(wildcard $(LOCAL_PATH)/src/hidapi/android/*.cpp) \
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/dummy/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \ $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \

View File

@@ -6,7 +6,7 @@ endif()
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW) set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)
cmake_minimum_required(VERSION 3.0.0...3.10) cmake_minimum_required(VERSION 3.0.0...3.10)
project(SDL2 C) project(SDL2 C CXX)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(SDL2_SUBPROJECT OFF) set(SDL2_SUBPROJECT OFF)
@@ -15,15 +15,13 @@ else()
endif() endif()
if (HAIKU) if (HAIKU)
enable_language(CXX)
set(LINKER_LANGUAGE CXX) set(LINKER_LANGUAGE CXX)
endif() endif()
set(EXTRA_LIBS) set(EXTRA_LIBS)
set(EXTRA_LDFLAGS) set(EXTRA_LDFLAGS)
set(CMAKE_LIBS) set(CMAKE_DEPENDS)
set(PKGCONFIG_LDFLAGS)
set(PKGCONFIG_DEPENDS) set(PKGCONFIG_DEPENDS)
# This is a virtual "library" that just exists to collect up compiler and # This is a virtual "library" that just exists to collect up compiler and
@@ -88,8 +86,8 @@ endif()
# See docs/release_checklist.md # See docs/release_checklist.md
set(SDL_MAJOR_VERSION 2) set(SDL_MAJOR_VERSION 2)
set(SDL_MINOR_VERSION 33) set(SDL_MINOR_VERSION 30)
set(SDL_MICRO_VERSION 0) set(SDL_MICRO_VERSION 10)
set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
# Set defaults preventing destination file conflicts # Set defaults preventing destination file conflicts
@@ -142,7 +140,6 @@ check_cpu_architecture(x86 SDL_CPU_X86)
check_cpu_architecture(x64 SDL_CPU_X64) check_cpu_architecture(x64 SDL_CPU_X64)
check_cpu_architecture(arm32 SDL_CPU_ARM32) check_cpu_architecture(arm32 SDL_CPU_ARM32)
check_cpu_architecture(arm64 SDL_CPU_ARM64) check_cpu_architecture(arm64 SDL_CPU_ARM64)
check_cpu_architecture(arm64ec SDL_CPU_ARM64EC)
check_cpu_architecture(loongarch64 SDL_CPU_LOONGARCH64) check_cpu_architecture(loongarch64 SDL_CPU_LOONGARCH64)
# Check for 64 or 32 bit # Check for 64 or 32 bit
@@ -198,7 +195,7 @@ endif()
# so we'll just use libusb when it's available. libusb does not support iOS, # so we'll just use libusb when it's available. libusb does not support iOS,
# so we default to yes on iOS. # so we default to yes on iOS.
# TODO: Windows can support libusb, the hid.c file just depends on Unix APIs # TODO: Windows can support libusb, the hid.c file just depends on Unix APIs
if((WINDOWS AND NOT WINDOWS_STORE) OR IOS OR TVOS OR VISIONOS OR WATCHOS OR ANDROID) if((WINDOWS AND NOT WINDOWS_STORE) OR IOS OR TVOS OR ANDROID)
set(HIDAPI_SKIP_LIBUSB TRUE) set(HIDAPI_SKIP_LIBUSB TRUE)
else() else()
set(HIDAPI_SKIP_LIBUSB FALSE) set(HIDAPI_SKIP_LIBUSB FALSE)
@@ -241,10 +238,10 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
endif() endif()
# Default option knobs # Default option knobs
if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS OR SDL_CPU_ARM64EC) if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS)
set(OPT_DEF_LIBC ON) set(OPT_DEF_LIBC ON)
endif() endif()
if(WINDOWS OR MACOS OR IOS OR TVOS OR VISIONOS OR WATCHOS) if(WINDOWS OR DARWIN OR MACOSX OR IOS OR TVOS)
set(SDL_SYSTEM_ICONV_DEFAULT OFF) set(SDL_SYSTEM_ICONV_DEFAULT OFF)
else() else()
set(SDL_SYSTEM_ICONV_DEFAULT ON) set(SDL_SYSTEM_ICONV_DEFAULT ON)
@@ -363,11 +360,6 @@ if(VITA OR PSP OR PS2 OR N3DS)
set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF) set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF)
endif() endif()
set(SDL_X11_XRANDR_DEFAULT ON)
if(SOLARIS)
set(SDL_X11_XRANDR_DEFAULT OFF)
endif()
# When defined, respect CMake's BUILD_SHARED_LIBS setting: # When defined, respect CMake's BUILD_SHARED_LIBS setting:
set(SDL_STATIC_ENABLED_BY_DEFAULT ON) set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT) if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT)
@@ -464,19 +456,17 @@ set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" ${SDL_CLOCK_GETTIME_ENABLED_BY_DEFAULT}) set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" ${SDL_CLOCK_GETTIME_ENABLED_BY_DEFAULT})
set_option(SDL_X11 "Use X11 video driver" ${UNIX_SYS}) set_option(SDL_X11 "Use X11 video driver" ${UNIX_SYS})
dep_option(SDL_X11_SHARED "Dynamically load X11 support" ON "SDL_X11" OFF) dep_option(SDL_X11_SHARED "Dynamically load X11 support" ON "SDL_X11" OFF)
dep_option(SDL_X11_XCURSOR "Enable Xcursor support" ON SDL_X11 OFF) set(SDL_X11_OPTIONS Xcursor Xdbe XInput Xfixes Xrandr Xscrnsaver XShape)
dep_option(SDL_X11_XDBE "Enable Xdbe support" ON SDL_X11 OFF) foreach(_SUB ${SDL_X11_OPTIONS})
dep_option(SDL_X11_XINPUT "Enable XInput support" ON SDL_X11 OFF) string(TOUPPER "SDL_X11_${_SUB}" _OPT)
dep_option(SDL_X11_XFIXES "Enable Xfixes support" ON SDL_X11 OFF) dep_option(${_OPT} "Enable ${_SUB} support" ON "SDL_X11" OFF)
dep_option(SDL_X11_XRANDR "Enable Xrandr support" "${SDL_X11_XRANDR_DEFAULT}" SDL_X11 OFF) endforeach()
dep_option(SDL_X11_XSCRNSAVER "Enable Xscrnsaver support" ON SDL_X11 OFF)
dep_option(SDL_X11_XSHAPE "Enable XShape support" ON SDL_X11 OFF)
set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS}) set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS})
dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF)
dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" OFF)
dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR;SDL_WAYLAND_SHARED" OFF) dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR;SDL_WAYLAND_SHARED" OFF)
dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF) dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF)
set_option(SDL_RPI "Use Raspberry Pi 0-3 video driver" ${UNIX_SYS}) set_option(SDL_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE}) set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE})
set_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) set_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(SDL_XINPUT "Use Xinput for Windows" ${WINDOWS}) set_option(SDL_XINPUT "Use Xinput for Windows" ${WINDOWS})
@@ -755,11 +745,6 @@ if(MSVC)
if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64") if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64")
list(APPEND EXTRA_LDFLAGS_BUILD "-CETCOMPAT") list(APPEND EXTRA_LDFLAGS_BUILD "-CETCOMPAT")
endif() endif()
# for VS >= 17.14 targeting ARM64: inline the Interlocked funcs
if(MSVC_VERSION GREATER 1943 AND SDL_CPU_ARM64 AND NOT SDL_LIBC)
list(APPEND EXTRA_CFLAGS /forceInterlockedFunctions-)
endif()
endif() endif()
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") if(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
@@ -1099,7 +1084,6 @@ if(SDL_LIBC)
endforeach() endforeach()
check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
check_symbol_exists(sigtimedwait "signal.h" HAVE_SIGTIMEDWAIT)
check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP) check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP)
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF) check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
@@ -1471,14 +1455,10 @@ elseif(EMSCRIPTEN)
elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
if(SDL_AUDIO) if(SDL_AUDIO)
if(SYSV5 OR SOLARIS OR HPUX) if(SYSV5 OR SOLARIS OR HPUX)
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
check_include_file(sys/audioio.h HAVE_SYS_AUDIOIO_H)
if(HAVE_SYS_AUDIOIO_H)
set(SDL_AUDIO_DRIVER_SUNAUDIO 1) set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c)
list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES}) list(APPEND SOURCE_FILES ${SUN_AUDIO_SOURCES})
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif()
elseif(NETBSD) elseif(NETBSD)
set(SDL_AUDIO_DRIVER_NETBSD 1) set(SDL_AUDIO_DRIVER_NETBSD 1)
file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c)
@@ -1793,7 +1773,6 @@ elseif(WINDOWS)
list(APPEND SOURCE_FILES ${CORE_SOURCES}) list(APPEND SOURCE_FILES ${CORE_SOURCES})
if(WINDOWS_STORE) if(WINDOWS_STORE)
enable_language(CXX)
file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp) file(GLOB WINRT_SOURCE_FILES ${SDL2_SOURCE_DIR}/src/core/winrt/*.c ${SDL2_SOURCE_DIR}/src/core/winrt/*.cpp)
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
endif() endif()
@@ -1839,10 +1818,8 @@ elseif(WINDOWS)
set(HAVE_DIRECTX TRUE) set(HAVE_DIRECTX TRUE)
if(NOT MINGW AND NOT USE_WINSDK_DIRECTX) if(NOT MINGW AND NOT USE_WINSDK_DIRECTX)
# TODO: change $ENV{DXSDL_DIR} to get the path from the include checks # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}" SDL2_TMP_DXSDK_LIB_DIR) target_link_directories(sdl-build-options INTERFACE "$$ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH}")
target_link_directories(sdl-build-options INTERFACE "${SDL2_TMP_DXSDK_LIB_DIR}") target_include_directories(sdl-build-options INTERFACE "$ENV{DXSDK_DIR}\\Include")
file(TO_CMAKE_PATH "$ENV{DXSDK_DIR}\\Include" SDL2_TMP_DXSDK_INCLUDE_DIR)
target_include_directories(sdl-build-options INTERFACE "${SDL2_TMP_DXSDK_INCLUDE_DIR}")
endif() endif()
endif() endif()
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
@@ -2077,7 +2054,6 @@ elseif(WINDOWS)
endif() endif()
endif() endif()
enable_language(RC)
file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc) file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c)
if(MINGW OR CYGWIN) if(MINGW OR CYGWIN)
@@ -2095,7 +2071,7 @@ elseif(APPLE)
# !!! FIXME: we need Carbon for some very old API calls in # !!! FIXME: we need Carbon for some very old API calls in
# !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out # !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out
# !!! FIXME: how to dump those. # !!! FIXME: how to dump those.
if(MACOS) if(DARWIN OR MACOSX)
set(SDL_FRAMEWORK_COCOA 1) set(SDL_FRAMEWORK_COCOA 1)
set(SDL_FRAMEWORK_CARBON 1) set(SDL_FRAMEWORK_CARBON 1)
endif() endif()
@@ -2109,12 +2085,12 @@ elseif(APPLE)
set(HAVE_SDL_FILE TRUE) set(HAVE_SDL_FILE TRUE)
endif() endif()
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c)
endif() endif()
if(SDL_MISC) if(SDL_MISC)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m)
else() else()
file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m)
@@ -2139,10 +2115,10 @@ elseif(APPLE)
if(SDL_JOYSTICK) if(SDL_JOYSTICK)
file(GLOB MFI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) file(GLOB MFI_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c)
set(SDL_JOYSTICK_MFI 1) set(SDL_JOYSTICK_MFI 1)
if(IOS OR VISIONOS OR WATCHOS) if(IOS)
set(SDL_FRAMEWORK_COREMOTION 1) set(SDL_FRAMEWORK_COREMOTION 1)
endif() endif()
set(SDL_FRAMEWORK_GAMECONTROLLER 1) set(SDL_FRAMEWORK_GAMECONTROLLER 1)
@@ -2183,7 +2159,7 @@ elseif(APPLE)
endif() endif()
if(SDL_HAPTIC) if(SDL_HAPTIC)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if (IOS OR TVOS)
file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
set(SDL_HAPTIC_DUMMY 1) set(SDL_HAPTIC_DUMMY 1)
else() else()
@@ -2197,7 +2173,7 @@ elseif(APPLE)
endif() endif()
if(SDL_POWER) if(SDL_POWER)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if (IOS OR TVOS)
file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m) file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/uikit/*.m)
set(SDL_POWER_UIKIT 1) set(SDL_POWER_UIKIT 1)
else() else()
@@ -2230,7 +2206,7 @@ elseif(APPLE)
endif() endif()
if(SDL_SENSOR) if(SDL_SENSOR)
if(IOS OR VISIONOS OR WATCHOS) if(IOS)
set(SDL_SENSOR_COREMOTION 1) set(SDL_SENSOR_COREMOTION 1)
set(HAVE_SDL_SENSORS TRUE) set(HAVE_SDL_SENSORS TRUE)
file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m) file(GLOB SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/coremotion/*.m)
@@ -2240,7 +2216,7 @@ elseif(APPLE)
# iOS hack needed - http://code.google.com/p/ios-cmake/ ? # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
if(SDL_VIDEO) if(SDL_VIDEO)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if (IOS OR TVOS)
set(SDL_VIDEO_DRIVER_UIKIT 1) set(SDL_VIDEO_DRIVER_UIKIT 1)
set(SDL_FRAMEWORK_COREGRAPHICS 1) set(SDL_FRAMEWORK_COREGRAPHICS 1)
set(SDL_FRAMEWORK_QUARTZCORE 1) set(SDL_FRAMEWORK_QUARTZCORE 1)
@@ -2261,7 +2237,7 @@ elseif(APPLE)
endif() endif()
if(SDL_OPENGLES) if(SDL_OPENGLES)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
set(SDL_FRAMEWORK_OPENGLES 1) set(SDL_FRAMEWORK_OPENGLES 1)
set(SDL_VIDEO_OPENGL_ES 1) set(SDL_VIDEO_OPENGL_ES 1)
set(SDL_VIDEO_RENDER_OGL_ES 1) set(SDL_VIDEO_RENDER_OGL_ES 1)
@@ -2304,96 +2280,73 @@ elseif(APPLE)
endif() endif()
endif() endif()
# Minimum version for $<LINK_LIBRARY:feature,library-list>
cmake_minimum_required(VERSION 3.24)
# Actually load the frameworks at the end so we don't duplicate include. # Actually load the frameworks at the end so we don't duplicate include.
if(SDL_FRAMEWORK_COREVIDEO) if(SDL_FRAMEWORK_COREVIDEO)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,CoreVideo") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreVideo")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreVideo>")
endif() endif()
if(SDL_FRAMEWORK_COCOA) if(SDL_FRAMEWORK_COCOA)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,Cocoa") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Cocoa")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,Cocoa>")
endif() endif()
if(SDL_FRAMEWORK_IOKIT) if(SDL_FRAMEWORK_IOKIT)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,IOKit") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,IOKit")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,IOKit>")
endif() endif()
if(SDL_FRAMEWORK_FF) if(SDL_FRAMEWORK_FF)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,ForceFeedback") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,ForceFeedback")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,ForceFeedback>")
endif() endif()
if(SDL_FRAMEWORK_CARBON) if(SDL_FRAMEWORK_CARBON)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,Carbon") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Carbon")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,Carbon>")
endif() endif()
if(SDL_FRAMEWORK_COREAUDIO) if(SDL_FRAMEWORK_COREAUDIO)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,CoreAudio") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreAudio")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreAudio>")
endif() endif()
if(SDL_FRAMEWORK_AUDIOTOOLBOX) if(SDL_FRAMEWORK_AUDIOTOOLBOX)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,AudioToolbox") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AudioToolbox")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,AudioToolbox>")
endif() endif()
if(SDL_FRAMEWORK_AVFOUNDATION) if(SDL_FRAMEWORK_AVFOUNDATION)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,AVFoundation") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,AVFoundation")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,AVFoundation>")
endif() endif()
if(SDL_FRAMEWORK_COREBLUETOOTH) if(SDL_FRAMEWORK_COREBLUETOOTH)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,CoreBluetooth") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreBluetooth")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreBluetooth>")
endif() endif()
if(SDL_FRAMEWORK_COREGRAPHICS) if(SDL_FRAMEWORK_COREGRAPHICS)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,CoreGraphics") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreGraphics")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,CoreGraphics>")
endif() endif()
if(SDL_FRAMEWORK_COREMOTION) if(SDL_FRAMEWORK_COREMOTION)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,CoreMotion") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,CoreMotion")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,Coremotion>")
endif() endif()
if(SDL_FRAMEWORK_FOUNDATION) if(SDL_FRAMEWORK_FOUNDATION)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,Foundation") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Foundation")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,Foundation>")
endif() endif()
if(SDL_FRAMEWORK_GAMECONTROLLER) if(SDL_FRAMEWORK_GAMECONTROLLER)
find_library(GAMECONTROLLER GameController) find_library(GAMECONTROLLER GameController)
if(GAMECONTROLLER) if(GAMECONTROLLER)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-weak_framework,GameController") list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,GameController")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,GameController>")
endif() endif()
endif() endif()
if(SDL_FRAMEWORK_METAL) if(SDL_FRAMEWORK_METAL)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,Metal") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,Metal")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,Metal>")
else() else()
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-weak_framework,Metal") list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,Metal")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,Metal>")
endif() endif()
endif() endif()
if(SDL_FRAMEWORK_OPENGLES) if(SDL_FRAMEWORK_OPENGLES)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,OpenGLES") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,OpenGLES")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,OpenGLES>")
endif() endif()
if(SDL_FRAMEWORK_QUARTZCORE) if(SDL_FRAMEWORK_QUARTZCORE)
if(IOS OR TVOS OR VISIONOS OR WATCHOS) if(IOS OR TVOS)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,QuartzCore") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,QuartzCore")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,QuartzCore>")
else() else()
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-weak_framework,QuartzCore") list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,QuartzCore")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,QuartzCore>")
endif() endif()
endif() endif()
if(SDL_FRAMEWORK_UIKIT) if(SDL_FRAMEWORK_UIKIT)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-framework,UIKit") list(APPEND EXTRA_LDFLAGS "-Wl,-framework,UIKit")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:FRAMEWORK,UIKit>")
endif() endif()
if(SDL_FRAMEWORK_COREHAPTICS) if(SDL_FRAMEWORK_COREHAPTICS)
find_library(COREHAPTICS CoreHaptics) find_library(COREHAPTICS CoreHaptics)
if(COREHAPTICS) if(COREHAPTICS)
list(APPEND PKGCONFIG_LDFLAGS "-Wl,-weak_framework,CoreHaptics") list(APPEND EXTRA_LDFLAGS "-Wl,-weak_framework,CoreHaptics")
list(APPEND CMAKE_LIBS "$<LINK_LIBRARY:WEAK_FRAMEWORK,CoreHaptics>")
endif() endif()
endif() endif()
@@ -2749,6 +2702,7 @@ elseif(PSP)
endif() endif()
elseif(PS2) elseif(PS2)
list(APPEND EXTRA_CFLAGS "-DPS2" "-D__PS2__" "-I$ENV{PS2SDK}/ports/include" "-I$ENV{PS2DEV}/gsKit/include")
file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c) file(GLOB PS2_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/ps2/*.c)
set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES}) set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${PS2_MAIN_SOURCES})
@@ -3199,7 +3153,7 @@ endif()
# Clean up the different lists # Clean up the different lists
listtostr(EXTRA_LIBS _EXTRA_LIBS "-l") listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
set(SDL_STATIC_LIBS ${EXTRA_LDFLAGS} ${_EXTRA_LIBS} ${PKGCONFIG_LDFLAGS}) set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
list(REMOVE_DUPLICATES SDL_STATIC_LIBS) list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS) listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS}) set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
@@ -3233,12 +3187,10 @@ macro(check_add_debug_flag FLAG SUFFIX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}")
endif() endif()
if(CMAKE_CXX_COMPILER)
check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX}) check_cxx_compiler_flag(${FLAG} HAS_CXX_${SUFFIX})
if (HAS_CXX_${SUFFIX}) if (HAS_CXX_${SUFFIX})
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
endif() endif()
endif()
endmacro() endmacro()
macro(asan_check_add_debug_flag ASAN_FLAG) macro(asan_check_add_debug_flag ASAN_FLAG)
@@ -3256,20 +3208,18 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
set (STORED_REQLIBS ${CMAKE_REQUIRED_LIBRARIES}) set (STORED_REQLIBS ${CMAKE_REQUIRED_LIBRARIES})
set (CMAKE_REQUIRED_LIBRARIES "${FLAG};asan") set (CMAKE_REQUIRED_LIBRARIES "${FLAG};asan")
check_c_compiler_flag (${FLAG} HAS_C_FLAG_${ASAN_FLAG}) check_c_compiler_flag (${FLAG} HAS_C_FLAG_${ASAN_FLAG})
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
set (CMAKE_REQUIRED_LIBRARIES ${STORED_REQLIBS})
if (HAS_C_FLAG_${ASAN_FLAG}) if (HAS_C_FLAG_${ASAN_FLAG})
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAG}")
endif() endif()
if(CMAKE_CXX_COMPILER)
check_cxx_compiler_flag (${FLAG} HAS_CXX_FLAG_${ASAN_FLAG})
if (HAS_CXX_${ASAN_FLAG}) if (HAS_CXX_${ASAN_FLAG})
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAG}")
endif() endif()
endif()
set (CMAKE_REQUIRED_LIBRARIES ${STORED_REQLIBS})
if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG}) if(HAS_C_${ASAN_FLAG} OR HAS_CXX_${ASAN_FLAG})
set(HAVE_ASAN ON) set(HAVE_ASAN ON)
endif() endif()
@@ -3493,7 +3443,7 @@ if(SDL_SHARED)
set_property(TARGET SDL2 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /NODEFAULTLIB") set_property(TARGET SDL2 APPEND_STRING PROPERTY STATIC_LIBRARY_FLAGS " /NODEFAULTLIB")
endif() endif()
# FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS # FIXME: if CMAKE_VERSION >= 3.13, use target_link_options for EXTRA_LDFLAGS
target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD} ${CMAKE_LIBS}) target_link_libraries(SDL2 PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${EXTRA_LDFLAGS_BUILD} ${CMAKE_DEPENDS})
target_include_directories(SDL2 PUBLIC target_include_directories(SDL2 PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>"
@@ -3529,7 +3479,7 @@ if(SDL_STATIC)
target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB) target_compile_definitions(SDL2-static PRIVATE SDL_STATIC_LIB)
# TODO: Win32 platforms keep the same suffix .lib for import and static # TODO: Win32 platforms keep the same suffix .lib for import and static
# libraries - do we need to consider this? # libraries - do we need to consider this?
target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${CMAKE_LIBS}) target_link_libraries(SDL2-static PRIVATE ${EXTRA_LIBS} ${EXTRA_LDFLAGS} ${CMAKE_DEPENDS})
target_include_directories(SDL2-static PUBLIC target_include_directories(SDL2-static PUBLIC
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>" "$<BUILD_INTERFACE:${SDL2_BINARY_DIR}/include/SDL2>"

View File

@@ -1,4 +1,4 @@
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -14,8 +14,8 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 33 MINOR_VERSION = 30
MICRO_VERSION = 0 MICRO_VERSION = 10
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
DESCRIPTION = Simple DirectMedia Layer 2 DESCRIPTION = Simple DirectMedia Layer 2

View File

@@ -5,8 +5,8 @@
LIBNAME = SDL2 LIBNAME = SDL2
MAJOR_VERSION = 2 MAJOR_VERSION = 2
MINOR_VERSION = 33 MINOR_VERSION = 30
MICRO_VERSION = 0 MICRO_VERSION = 10
VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION)
LIBHOME = . LIBHOME = .

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -371,7 +371,6 @@
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion> <TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion> <TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.0.0</WindowsTargetPlatformMinVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -392,7 +391,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>

View File

@@ -188,12 +188,6 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies> <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly> <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj"> <ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project> <Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private> <Private>false</Private>

View File

@@ -216,12 +216,6 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies> <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly> <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj"> <ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project> <Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private> <Private>false</Private>

View File

@@ -188,12 +188,6 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies> <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly> <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj"> <ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project> <Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private> <Private>false</Private>

View File

@@ -194,12 +194,6 @@
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies> <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly> <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj"> <ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project> <Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
<Private>false</Private> <Private>false</Private>

View File

@@ -456,10 +456,7 @@ main(int argc, char *argv[])
while (!done) { while (!done) {
SDL_Event event; SDL_Event event;
double deltaTime = updateDeltaTime(); double deltaTime = updateDeltaTime();
SDL_bool hasEvents = SDL_FALSE;
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
hasEvents = SDL_TRUE;
if (event.type == SDL_QUIT) { if (event.type == SDL_QUIT) {
done = 1; done = 1;
} }
@@ -469,17 +466,10 @@ main(int argc, char *argv[])
spawnEmitterParticle(x, y); spawnEmitterParticle(x, y);
} }
} }
/* Only update and render if we have active particles or just received events */
if (num_active_particles > 0 || hasEvents) {
stepParticles(deltaTime); stepParticles(deltaTime);
drawParticles(); drawParticles();
SDL_GL_SwapWindow(window); SDL_GL_SwapWindow(window);
SDL_Delay(16); // Target 60 FPS when active SDL_Delay(1);
} else {
/* Idle state - wait for events with longer delay to save CPU */
SDL_Delay(100); // Much longer delay when idle
}
} }
/* delete textures */ /* delete textures */

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.33.0</string> <string>2.30.10</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>SDLX</string> <string>SDLX</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2.33.0</string> <string>2.30.10</string>
</dict> </dict>
</plist> </plist>

View File

@@ -9728,8 +9728,8 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES; DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 3301.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3301.0.0; DYLIB_CURRENT_VERSION = 3001.10.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES; GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9770,7 +9770,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.33.0; MARKETING_VERSION = 2.30.10;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Release; name = Release;
@@ -9813,8 +9813,8 @@
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf; DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 3301.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3301.0.0; DYLIB_CURRENT_VERSION = 3001.10.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES; ENABLE_TESTABILITY = YES;
@@ -9856,7 +9856,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_LINK_OBJC_RUNTIME = NO; CLANG_LINK_OBJC_RUNTIME = NO;
MARKETING_VERSION = 2.33.0; MARKETING_VERSION = 2.30.10;
OTHER_LDFLAGS = "-liconv"; OTHER_LDFLAGS = "-liconv";
}; };
name = Debug; name = Debug;
@@ -10062,8 +10062,8 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3301.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3301.0.0; DYLIB_CURRENT_VERSION = 3001.10.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
@@ -10114,8 +10114,8 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 3301.0.0; DYLIB_COMPATIBILITY_VERSION = 3001.0.0;
DYLIB_CURRENT_VERSION = 3301.0.0; DYLIB_CURRENT_VERSION = 3001.10.0;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO; ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11; GCC_C_LANGUAGE_STANDARD = gnu11;

View File

@@ -1,4 +1,4 @@
Title SDL 2.33.0 Title SDL 2.30.10
Version 1 Version 1
Description SDL Library for Mac OS X (http://www.libsdl.org) Description SDL Library for Mac OS X (http://www.libsdl.org)
DefaultLocation /Library/Frameworks DefaultLocation /Library/Frameworks

View File

@@ -1,6 +1,6 @@
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

44
acinclude/libtool.m4 vendored
View File

@@ -1023,21 +1023,6 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
rm -f conftest.* rm -f conftest.*
fi]) fi])
# Feature test to disable chained fixups since it is not
# compatible with '-undefined dynamic_lookup'
AC_CACHE_CHECK([for -no_fixup_chains linker flag],
[lt_cv_support_no_fixup_chains],
[ save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([],[])],
lt_cv_support_no_fixup_chains=yes,
lt_cv_support_no_fixup_chains=no
)
LDFLAGS=$save_LDFLAGS
]
)
AC_CACHE_CHECK([for -exported_symbols_list linker flag], AC_CACHE_CHECK([for -exported_symbols_list linker flag],
[lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list],
[lt_cv_ld_exported_symbols_list=no [lt_cv_ld_exported_symbols_list=no
@@ -1062,7 +1047,7 @@ _LT_EOF
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF cat > conftest.c << _LT_EOF
int main(void) { return 0;} int main() { return 0;}
_LT_EOF _LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
@@ -1087,12 +1072,7 @@ _LT_EOF
10.[[012]],*|,*powerpc*-darwin[[5-8]]*) 10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*) *)
if test yes = "$lt_cv_support_no_fixup_chains"; then _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup $wl-no_fixup_chains'
else
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup'
fi
;;
esac esac
;; ;;
esac esac
@@ -1882,11 +1862,11 @@ else
/* When -fvisibility=hidden is used, assume the code has been annotated /* When -fvisibility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */ correspondingly for the symbols needed. */
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord (void) __attribute__((visibility("default"))); int fnord () __attribute__((visibility("default")));
#endif #endif
int fnord (void) { return 42; } int fnord () { return 42; }
int main (void) int main ()
{ {
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown; int status = $lt_dlunknown;
@@ -2567,14 +2547,14 @@ cygwin* | mingw* | windows* | pw32* | cegcc*)
cygwin*) cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib' # Cygwin DLLs use 'cyg' prefix rather than 'lib'
#soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization
m4_if([$1], [],[ m4_if([$1], [],[
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
;; ;;
mingw* | windows* | cegcc*) mingw* | windows* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix # MinGW DLLs use traditional 'lib' prefix
#soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization
;; ;;
pw32*) pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib' # pw32 DLLs use 'pw' prefix rather than 'lib'
@@ -3486,7 +3466,7 @@ cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh # func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid' lt_cv_file_magic_cmd='func_win32_libid'
lt_cv_deplibs_check_method=pass_all # SDL customization. lt_cv_deplibs_check_method=pass_all # SDL customization
;; ;;
mingw* | windows* | pw32*) mingw* | windows* | pw32*)
@@ -3498,10 +3478,10 @@ mingw* | windows* | pw32*)
lt_cv_file_magic_cmd='func_win32_libid' lt_cv_file_magic_cmd='func_win32_libid'
else else
# Keep this pattern in sync with the one in func_win32_libid. # Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f' lt_cv_file_magic_cmd='$OBJDUMP -f'
fi fi
lt_cv_deplibs_check_method=pass_all # SDL customization. lt_cv_deplibs_check_method=pass_all # SDL customization
;; ;;
cegcc*) cegcc*)
@@ -4072,7 +4052,7 @@ void nm_test_func(void){}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
int main(void){nm_test_var='a';nm_test_func();return(0);} int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF _LT_EOF
if AC_TRY_EVAL(ac_compile); then if AC_TRY_EVAL(ac_compile); then
@@ -6238,7 +6218,7 @@ _LT_TAGVAR(objext, $1)=$objext
lt_simple_compile_test_code="int some_variable = 0;" lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests # Code to be used in simple link tests
lt_simple_link_test_code='int main(void){return(0);}' lt_simple_link_test_code='int main(){return(0);}'
_LT_TAG_COMPILER _LT_TAG_COMPILER
# Save the default compiler, since it gets overwritten when the other # Save the default compiler, since it gets overwritten when the other

View File

@@ -15,84 +15,3 @@
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *; # public *;
#} #}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLInputConnection {
void nativeCommitText(java.lang.String, int);
void nativeGenerateScancodeForUnichar(char);
}
-keep,includedescriptorclasses class org.libsdl.app.SDLActivity {
# for some reason these aren't compatible with allowoptimization modifier
boolean supportsRelativeMouse();
void setWindowStyle(boolean);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity {
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
boolean onNativeSoftReturnKey();
void onNativeKeyboardFocusLost();
boolean isScreenKeyboardShown();
android.util.DisplayMetrics getDisplayDPI();
java.lang.String clipboardGetText();
boolean clipboardHasText();
void clipboardSetText(java.lang.String);
int createCustomCursor(int[], int, int, int, int);
void destroyCustomCursor(int);
android.content.Context getContext();
boolean getManifestEnvironmentVariables();
android.view.Surface getNativeSurface();
void initTouch();
boolean isAndroidTV();
boolean isChromebook();
boolean isDeXMode();
boolean isTablet();
void manualBackButton();
int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]);
void minimizeWindow();
int openURL(java.lang.String);
void requestPermission(java.lang.String, int);
int showToast(java.lang.String, int, int, int, int);
boolean sendMessage(int, int);
boolean setActivityTitle(java.lang.String);
boolean setCustomCursor(int);
void setOrientation(int, int, boolean, java.lang.String);
boolean setRelativeMouseEnabled(boolean);
boolean setSystemCursor(int);
boolean shouldMinimizeOnFocusLoss();
boolean showTextInput(int, int, int, int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager {
boolean initialize(boolean, boolean);
boolean openDevice(int);
int sendOutputReport(int, byte[]);
int sendFeatureReport(int, byte[]);
boolean getFeatureReport(int, byte[]);
void closeDevice(int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager {
int[] getAudioOutputDevices();
int[] getAudioInputDevices();
int[] audioOpen(int, int, int, int, int);
void audioWriteFloatBuffer(float[]);
void audioWriteShortBuffer(short[]);
void audioWriteByteBuffer(byte[]);
void audioClose();
int[] captureOpen(int, int, int, int, int);
int captureReadFloatBuffer(float[], boolean);
int captureReadShortBuffer(short[], boolean);
int captureReadByteBuffer(byte[], boolean);
void captureClose();
void audioSetThreadPriority(boolean, int);
native int nativeSetupJNI();
native void removeAudioDevice(boolean, int);
native void addAudioDevice(boolean, int);
}
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager {
void pollInputDevices();
void pollHapticDevices();
void hapticRun(int, float, int);
void hapticStop(int);
}

View File

@@ -60,8 +60,8 @@ import java.util.Locale;
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL"; private static final String TAG = "SDL";
private static final int SDL_MAJOR_VERSION = 2; private static final int SDL_MAJOR_VERSION = 2;
private static final int SDL_MINOR_VERSION = 33; private static final int SDL_MINOR_VERSION = 30;
private static final int SDL_MICRO_VERSION = 0; private static final int SDL_MICRO_VERSION = 10;
/* /*
// Display InputType.SOURCE/CLASS of events and devices // Display InputType.SOURCE/CLASS of events and devices
// //
@@ -790,9 +790,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
SDLActivity.mFullscreenModeActive = false; SDLActivity.mFullscreenModeActive = false;
} }
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
} }
} else { } else {
Log.e(TAG, "error handling message, getContext() returned no Activity"); Log.e(TAG, "error handling message, getContext() returned no Activity");

View File

@@ -80,8 +80,7 @@ do
cd $folder cd $folder
done done
# Uppercase the first char in the activity class name because it's Java ACTIVITY="${folder}Activity"
ACTIVITY="$(echo $folder | awk '{$1=toupper(substr($1,0,1))substr($1,2)}1')Activity"
sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml
# Fill in a default Activity # Fill in a default Activity

View File

@@ -37,8 +37,6 @@ logger = logging.getLogger(__name__)
GIT_HASH_FILENAME = ".git-hash" GIT_HASH_FILENAME = ".git-hash"
REVISION_TXT = "REVISION.txt" REVISION_TXT = "REVISION.txt"
RE_ILLEGAL_MINGW_LIBRARIES = re.compile(r"(?:lib)?(?:gcc|(?:std)?c[+][+]|(?:win)?pthread).*", flags=re.I)
def safe_isotime_to_datetime(str_isotime: str) -> datetime.datetime: def safe_isotime_to_datetime(str_isotime: str) -> datetime.datetime:
try: try:
@@ -330,10 +328,6 @@ def configure_text(text: str, context: dict[str, str]) -> str:
return text return text
def configure_text_list(text_list: list[str], context: dict[str, str]) -> list[str]:
return [configure_text(text=e, context=context) for e in text_list]
class ArchiveFileTree: class ArchiveFileTree:
def __init__(self): def __init__(self):
self._tree: dict[str, NodeInArchive] = {} self._tree: dict[str, NodeInArchive] = {}
@@ -341,12 +335,6 @@ class ArchiveFileTree:
def add_file(self, file: NodeInArchive): def add_file(self, file: NodeInArchive):
self._tree[file.arcpath] = file self._tree[file.arcpath] = file
def __iter__(self) -> typing.Iterable[NodeInArchive]:
yield from self._tree.values()
def __contains__(self, value: str) -> bool:
return value in self._tree
def get_latest_mod_time(self) -> datetime.datetime: def get_latest_mod_time(self) -> datetime.datetime:
return max(item.time for item in self._tree.values() if item.time) return max(item.time for item in self._tree.values() if item.time)
@@ -361,6 +349,7 @@ class ArchiveFileTree:
target = dest_dir + s.symtarget target = dest_dir + s.symtarget
while True: while True:
new_target, n = re.subn(r"([^/]+/+[.]{2}/)", "", target) new_target, n = re.subn(r"([^/]+/+[.]{2}/)", "", target)
print(f"{target=} {new_target=}")
target = new_target target = new_target
if not n: if not n:
break break
@@ -368,14 +357,13 @@ class ArchiveFileTree:
# Add files in first pass # Add files in first pass
for arcpath, node in self._tree.items(): for arcpath, node in self._tree.items():
assert node is not None, f"{arcpath} -> node"
if node.data is not None: if node.data is not None:
archiver.add_file_data(arcpath=arc_join(archive_base, arcpath), data=node.data, time=node.time, mode=node.mode) archiver.add_file_data(arcpath=arc_join(archive_base, arcpath), data=node.data, time=node.time, mode=node.mode)
assert node.arcpath is not None, f"{node=}" assert node.arcpath is not None, f"{node=} has arcpath=None"
added_files[node.arcpath] = node added_files[node.arcpath] = node
elif node.path is not None: elif node.path is not None:
archiver.add_file_path(arcpath=arc_join(archive_base, arcpath), path=node.path) archiver.add_file_path(arcpath=arc_join(archive_base, arcpath), path=node.path)
assert node.arcpath is not None, f"{node=}" assert node.arcpath is not None, f"{node=} has arcpath=None"
added_files[node.arcpath] = node added_files[node.arcpath] = node
elif node.symtarget is not None: elif node.symtarget is not None:
remaining_symlinks.add(node) remaining_symlinks.add(node)
@@ -384,8 +372,6 @@ class ArchiveFileTree:
else: else:
raise ValueError(f"Invalid Archive Node: {repr(node)}") raise ValueError(f"Invalid Archive Node: {repr(node)}")
assert None not in added_files
# Resolve symlinks in second pass: zipfile does not support symlinks, so add files to zip archive # Resolve symlinks in second pass: zipfile does not support symlinks, so add files to zip archive
while True: while True:
if not remaining_symlinks: if not remaining_symlinks:
@@ -534,16 +520,6 @@ class SourceCollector:
return path_times return path_times
class AndroidApiVersion:
def __init__(self, name: str, ints: tuple[int, ...]):
self.name = name
self.ints = ints
def __repr__(self) -> str:
return f"<{self.name} ({'.'.join(str(v) for v in self.ints)})>"
ANDROID_ABI_EXTRA_LINK_OPTIONS = {}
class Releaser: class Releaser:
def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool): def __init__(self, release_info: dict, commit: str, revision: str, root: Path, dist_path: Path, section_printer: SectionPrinter, executer: Executer, cmake_generator: str, deps_path: Path, overwrite: bool, github: bool, fast: bool):
self.release_info = release_info self.release_info = release_info
@@ -571,7 +547,6 @@ class Releaser:
"PROJECT_VERSION": self.version, "PROJECT_VERSION": self.version,
"PROJECT_COMMIT": self.commit, "PROJECT_COMMIT": self.commit,
"PROJECT_REVISION": self.revision, "PROJECT_REVISION": self.revision,
"PROJECT_ROOT": str(self.root),
} }
if extra_context: if extra_context:
ctx.update(extra_context) ctx.update(extra_context)
@@ -604,22 +579,12 @@ class Releaser:
def create_source_archives(self) -> None: def create_source_archives(self) -> None:
source_collector = SourceCollector(root=self.root, commit=self.commit, executer=self.executer, filter=self._path_filter) source_collector = SourceCollector(root=self.root, commit=self.commit, executer=self.executer, filter=self._path_filter)
print(f"Collecting sources of {self.project}...") print(f"Collecting sources of {self.project}...")
archive_tree: ArchiveFileTree = source_collector.get_archive_file_tree() archive_tree = source_collector.get_archive_file_tree()
latest_mod_time = archive_tree.get_latest_mod_time() latest_mod_time = archive_tree.get_latest_mod_time()
archive_tree.add_file(NodeInArchive.from_text(arcpath=REVISION_TXT, text=f"{self.revision}\n", time=latest_mod_time)) archive_tree.add_file(NodeInArchive.from_text(arcpath=REVISION_TXT, text=f"{self.revision}\n", time=latest_mod_time))
archive_tree.add_file(NodeInArchive.from_text(arcpath=f"{GIT_HASH_FILENAME}", text=f"{self.commit}\n", time=latest_mod_time)) archive_tree.add_file(NodeInArchive.from_text(arcpath=f"{GIT_HASH_FILENAME}", text=f"{self.commit}\n", time=latest_mod_time))
archive_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["source"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=latest_mod_time) archive_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["source"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=latest_mod_time)
if "Makefile.am" in archive_tree:
patched_time = latest_mod_time + datetime.timedelta(minutes=1)
print(f"Makefile.am detected -> touching aclocal.m4, */Makefile.in, configure")
for node_data in archive_tree:
arc_name = os.path.basename(node_data.arcpath)
arc_name_we, arc_name_ext = os.path.splitext(arc_name)
if arc_name in ("aclocal.m4", "configure", "Makefile.in"):
print(f"Bumping time of {node_data.arcpath}")
node_data.time = patched_time
archive_base = f"{self.project}-{self.version}" archive_base = f"{self.project}-{self.version}"
zip_path = self.dist_path / f"{archive_base}.zip" zip_path = self.dist_path / f"{archive_base}.zip"
tgz_path = self.dist_path / f"{archive_base}.tar.gz" tgz_path = self.dist_path / f"{archive_base}.tar.gz"
@@ -696,15 +661,6 @@ class Releaser:
def git_hash_data(self) -> bytes: def git_hash_data(self) -> bytes:
return f"{self.commit}\n".encode() return f"{self.commit}\n".encode()
def verify_mingw_library(self, triplet: str, path: Path):
objdump_output = self.executer.check_output([f"{triplet}-objdump", "-p", str(path)])
libraries = re.findall(r"DLL Name: ([^\n]+)", objdump_output)
logger.info("%s (%s) libraries: %r", path, triplet, libraries)
illegal_libraries = list(filter(RE_ILLEGAL_MINGW_LIBRARIES.match, libraries))
logger.error("Detected 'illegal' libraries: %r", illegal_libraries)
if illegal_libraries:
raise Exception(f"{path} links to illegal libraries: {illegal_libraries}")
def create_mingw_archives(self) -> None: def create_mingw_archives(self) -> None:
build_type = "Release" build_type = "Release"
build_parent_dir = self.root / "build-mingw" build_parent_dir = self.root / "build-mingw"
@@ -787,31 +743,22 @@ class Releaser:
install_path = build_parent_dir / f"install-{triplet}" install_path = build_parent_dir / f"install-{triplet}"
shutil.rmtree(install_path, ignore_errors=True) shutil.rmtree(install_path, ignore_errors=True)
build_path.mkdir(parents=True, exist_ok=True) build_path.mkdir(parents=True, exist_ok=True)
context = self.get_context({
"ARCH": arch,
"DEP_PREFIX": str(mingw_deps_path / triplet),
})
extra_args = configure_text_list(text_list=self.release_info["mingw"]["autotools"]["args"], context=context)
with self.section_printer.group(f"Configuring MinGW {triplet} (autotools)"): with self.section_printer.group(f"Configuring MinGW {triplet} (autotools)"):
extra_args = [arg.replace("@DEP_PREFIX@", str(mingw_deps_path / triplet)) for arg in self.release_info["mingw"]["autotools"]["args"]]
assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})" assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})"
self.executer.run([ self.executer.run([
self.root / "configure", self.root / "configure",
f"--prefix={install_path}", f"--prefix={install_path}",
f"--includedir=${{prefix}}/include", f"--includedir={install_path}/include",
f"--libdir=${{prefix}}/lib", f"--libdir={install_path}/lib",
f"--bindir=${{prefix}}/bin", f"--bindir={install_path}/bin",
f"--host={triplet}", f"--host={triplet}",
f"--build=x86_64-none-linux-gnu", f"--build=x86_64-none-linux-gnu",
"CFLAGS=-O2",
"CXXFLAGS=-O2",
"LDFLAGS=-Wl,-s",
] + extra_args, cwd=build_path, env=new_env) ] + extra_args, cwd=build_path, env=new_env)
with self.section_printer.group(f"Build MinGW {triplet} (autotools)"): with self.section_printer.group(f"Build MinGW {triplet} (autotools)"):
self.executer.run(["make", f"-j{self.cpu_count}"], cwd=build_path, env=new_env) self.executer.run(["make", f"-j{self.cpu_count}"], cwd=build_path, env=new_env)
with self.section_printer.group(f"Install MinGW {triplet} (autotools)"): with self.section_printer.group(f"Install MinGW {triplet} (autotools)"):
self.executer.run(["make", "install"], cwd=build_path, env=new_env) self.executer.run(["make", "install"], cwd=build_path, env=new_env)
self.verify_mingw_library(triplet=ARCH_TO_TRIPLET[arch], path=install_path / "bin" / f"{self.project}.dll")
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time) archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
print("Recording arch-dependent extra files for MinGW development archive ...") print("Recording arch-dependent extra files for MinGW development archive ...")
@@ -831,12 +778,6 @@ class Releaser:
assert arch not in mingw_archs assert arch not in mingw_archs
mingw_archs.add(arch) mingw_archs.add(arch)
context = self.get_context({
"ARCH": arch,
"DEP_PREFIX": str(mingw_deps_path / triplet),
})
extra_args = configure_text_list(text_list=self.release_info["mingw"]["cmake"]["args"], context=context)
build_path = build_parent_dir / f"build-{triplet}" build_path = build_parent_dir / f"build-{triplet}"
install_path = build_parent_dir / f"install-{triplet}" install_path = build_parent_dir / f"install-{triplet}"
shutil.rmtree(install_path, ignore_errors=True) shutil.rmtree(install_path, ignore_errors=True)
@@ -847,6 +788,7 @@ class Releaser:
args_for_shared_static = (["-DBUILD_SHARED_LIBS=ON"], ["-DBUILD_SHARED_LIBS=OFF"]) args_for_shared_static = (["-DBUILD_SHARED_LIBS=ON"], ["-DBUILD_SHARED_LIBS=OFF"])
for arg_for_shared_static in args_for_shared_static: for arg_for_shared_static in args_for_shared_static:
with self.section_printer.group(f"Configuring MinGW {triplet} (CMake)"): with self.section_printer.group(f"Configuring MinGW {triplet} (CMake)"):
extra_args = [arg.replace("@DEP_PREFIX@", str(mingw_deps_path / triplet)) for arg in self.release_info["mingw"]["cmake"]["args"]]
assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})" assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})"
self.executer.run([ self.executer.run([
f"cmake", f"cmake",
@@ -867,7 +809,6 @@ class Releaser:
self.executer.run(["cmake", "--build", str(build_path), "--verbose", "--config", build_type], cwd=build_path, env=new_env) self.executer.run(["cmake", "--build", str(build_path), "--verbose", "--config", build_type], cwd=build_path, env=new_env)
with self.section_printer.group(f"Install MinGW {triplet} (CMake)"): with self.section_printer.group(f"Install MinGW {triplet} (CMake)"):
self.executer.run(["cmake", "--install", str(build_path)], cwd=build_path, env=new_env) self.executer.run(["cmake", "--install", str(build_path)], cwd=build_path, env=new_env)
self.verify_mingw_library(triplet=ARCH_TO_TRIPLET[arch], path=install_path / "bin" / f"{self.project}.dll")
archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time) archive_file_tree.add_directory_tree(arc_dir=arc_join(arc_root, triplet), path=install_path, time=self.arc_time)
print("Recording arch-dependent extra files for MinGW development archive ...") print("Recording arch-dependent extra files for MinGW development archive ...")
@@ -895,25 +836,22 @@ class Releaser:
self.artifacts["mingw-devel-tar-gz"] = tgz_path self.artifacts["mingw-devel-tar-gz"] = tgz_path
self.artifacts["mingw-devel-tar-xz"] = txz_path self.artifacts["mingw-devel-tar-xz"] = txz_path
def _detect_android_api(self, android_home: str) -> typing.Optional[AndroidApiVersion]: def _detect_android_api(self, android_home: str) -> typing.Optional[int]:
platform_dirs = list(Path(p) for p in glob.glob(f"{android_home}/platforms/android-*")) platform_dirs = list(Path(p) for p in glob.glob(f"{android_home}/platforms/android-*"))
re_platform = re.compile("^android-([0-9]+)(?:-ext([0-9]+))?$") re_platform = re.compile("android-([0-9]+)")
platform_versions: list[AndroidApiVersion] = [] platform_versions = []
for platform_dir in platform_dirs: for platform_dir in platform_dirs:
logger.debug("Found Android Platform SDK: %s", platform_dir) 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 m:= re_platform.match(platform_dir.name): if m:= re_platform.match(platform_dir.name):
platform_versions.append(AndroidApiVersion(name=platform_dir.name, ints=(int(m.group(1)), int(m.group(2) or 0)))) platform_versions.append(int(m.group(1)))
platform_versions.sort(key=lambda v: v.ints) platform_versions.sort()
logger.info("Available platform versions: %s", platform_versions) logger.info("Available platform versions: %s", platform_versions)
platform_versions = list(filter(lambda v: v.ints >= self._android_api_minimum.ints, platform_versions)) platform_versions = list(filter(lambda v: v >= self._android_api_minimum, platform_versions))
logger.info("Valid platform versions (>=%s): %s", self._android_api_minimum.ints, platform_versions) logger.info("Valid platform versions (>=%d): %s", self._android_api_minimum, platform_versions)
if not platform_versions: if not platform_versions:
return None return None
android_api = platform_versions[0] android_api = platform_versions[0]
logger.info("Selected API version %s", android_api) logger.info("Selected API version %d", android_api)
return android_api return android_api
def _get_prefab_json_text(self) -> str: def _get_prefab_json_text(self) -> str:
@@ -937,19 +875,8 @@ class Releaser:
return json.dumps(module_json_dict, indent=4) return json.dumps(module_json_dict, indent=4)
@property @property
def _android_api_minimum(self) -> AndroidApiVersion: def _android_api_minimum(self):
value = self.release_info["android"]["api-minimum"] return self.release_info["android"]["api-minimum"]
if isinstance(value, int):
ints = (value, )
elif isinstance(value, str):
ints = tuple(split("."))
else:
raise ValueError("Invalid android.api-minimum: must be X or X.Y")
match len(ints):
case 1: name = f"android-{ints[0]}"
case 2: name = f"android-{ints[0]}-ext-{ints[1]}"
case _: raise ValueError("Invalid android.api-minimum: must be X or X.Y")
return AndroidApiVersion(name=name, ints=ints)
@property @property
def _android_api_target(self): def _android_api_target(self):
@@ -962,7 +889,7 @@ class Releaser:
def _get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str: def _get_prefab_abi_json_text(self, abi: str, cpp: bool, shared: bool) -> str:
abi_json_dict = { abi_json_dict = {
"abi": abi, "abi": abi,
"api": self._android_api_minimum.ints[0], "api": self._android_api_minimum,
"ndk": self._android_ndk_minimum, "ndk": self._android_ndk_minimum,
"stl": "c++_shared" if cpp else "none", "stl": "c++_shared" if cpp else "none",
"static": not shared, "static": not shared,
@@ -975,7 +902,7 @@ class Releaser:
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="org.libsdl.android.{self.project}" android:versionCode="1" package="org.libsdl.android.{self.project}" android:versionCode="1"
android:versionName="1.0"> android:versionName="1.0">
<uses-sdk android:minSdkVersion="{self._android_api_minimum.ints[0]}" <uses-sdk android:minSdkVersion="{self._android_api_minimum}"
android:targetSdkVersion="{self._android_api_target}" /> android:targetSdkVersion="{self._android_api_target}" />
</manifest> </manifest>
""") """)
@@ -985,8 +912,7 @@ class Releaser:
if not cmake_toolchain_file.exists(): if not cmake_toolchain_file.exists():
logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file) logger.error("CMake toolchain file does not exist (%s)", cmake_toolchain_file)
raise SystemExit(1) raise SystemExit(1)
aar_path = self.root / "build-android" / f"{self.project}-{self.version}.aar" aar_path = self.dist_path / 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"] android_abis = self.release_info["android"]["abis"]
java_jars_added = False java_jars_added = False
module_data_added = False module_data_added = False
@@ -994,27 +920,16 @@ class Releaser:
shutil.rmtree(android_deps_path, ignore_errors=True) shutil.rmtree(android_deps_path, ignore_errors=True)
for dep, depinfo in self.release_info["android"].get("dependencies", {}).items(): for dep, depinfo in self.release_info["android"].get("dependencies", {}).items():
dep_devel_zip = self.deps_path / glob.glob(depinfo["artifact"], root_dir=self.deps_path)[0] 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})"):
dep_extract_path = self.deps_path / f"extract/android/{dep}" self.executer.run([sys.executable, str(android_aar), "-o", str(android_deps_path)])
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(): 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" assert "type" in module_info and module_info["type"] in ("interface", "library"), f"module {module_name} must have a valid type"
aar_file_tree = ArchiveFileTree() archive_file_tree = ArchiveFileTree()
android_devel_file_tree = ArchiveFileTree()
for android_abi in android_abis: for android_abi in android_abis:
extra_link_options = ANDROID_ABI_EXTRA_LINK_OPTIONS.get(android_abi, "")
with self.section_printer.group(f"Building for Android {android_api} {android_abi}"): with self.section_printer.group(f"Building for Android {android_api} {android_abi}"):
build_dir = self.root / "build-android" / f"{android_abi}-build" build_dir = self.root / "build-android" / f"{android_abi}-build"
install_dir = self.root / "install-android" / f"{android_abi}-install" install_dir = self.root / "install-android" / f"{android_abi}-install"
@@ -1025,11 +940,8 @@ class Releaser:
"cmake", "cmake",
"-S", str(self.root), "-S", str(self.root),
"-B", str(build_dir), "-B", str(build_dir),
# NDK 21e does not support -ffile-prefix-map f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''', f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}", f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}", f"-DCMAKE_PREFIX_PATH={str(android_deps_path)}",
f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH", f"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
@@ -1066,20 +978,20 @@ class Releaser:
assert library.suffix in (".so", ".a") assert library.suffix in (".so", ".a")
assert library.is_file(), f"CMake should have built library '{library}' for module {module_name}" 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}" arcdir_prefab_libs = f"{arcdir_prefab_module}/libs/android.{android_abi}"
aar_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_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)) 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))
if not module_data_added: if not module_data_added:
library_name = None library_name = None
if module_info["type"] == "library": if module_info["type"] == "library":
library_name = Path(module_info["library"]).stem.removeprefix("lib") library_name = Path(module_info["library"]).stem.removeprefix("lib")
export_libraries = module_info.get("export-libraries", []) export_libraries = module_info.get("export-libraries", [])
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)) 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))
arcdir_prefab_include = f"prefab/modules/{module_name}/include" arcdir_prefab_include = f"prefab/modules/{module_name}/include"
if "includes" in module_info: if "includes" in module_info:
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) 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)
else: else:
aar_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time)) archive_file_tree.add_file(NodeInArchive.from_text(arcpath=arc_join(arcdir_prefab_include, ".keep"), text="\n", time=self.arc_time))
module_data_added = True module_data_added = True
if not java_jars_added: if not java_jars_added:
@@ -1092,28 +1004,21 @@ class Releaser:
assert sources_jar_path.is_file(), f"CMake should have archived the java sources into a JAR ({sources_jar_path})" 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})" assert doc_jar_path.is_file(), f"CMake should have archived javadoc into a JAR ({doc_jar_path})"
aar_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.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)) archive_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)) archive_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" 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"
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_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(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="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)) archive_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: with Archiver(zip_path=aar_path) as archiver:
aar_file_tree.add_to_archiver(archive_base="", archiver=archiver) archive_file_tree.add_to_archiver(archive_base="", archiver=archiver)
archiver.add_git_hash(arcdir="", commit=self.commit, time=self.arc_time) 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): def download_dependencies(self):
shutil.rmtree(self.deps_path, ignore_errors=True) shutil.rmtree(self.deps_path, ignore_errors=True)
@@ -1150,7 +1055,7 @@ class Releaser:
assert len(msvc_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}" assert len(msvc_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
if "android" in self.release_info: if "android" in self.release_info:
android_matches = glob.glob(self.release_info["android"]["dependencies"][dep]["artifact"], root_dir=self.deps_path) 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: {android_matches}" assert len(android_matches) == 1, f"Exactly one archive matches msvc {dep} dependency: {msvc_matches}"
@staticmethod @staticmethod
def _arch_to_vs_platform(arch: str, configuration: str="Release") -> VsArchPlatformConfig: def _arch_to_vs_platform(arch: str, configuration: str="Release") -> VsArchPlatformConfig:
@@ -1276,10 +1181,6 @@ class Releaser:
platform_context = self.get_context(extra_context=arch_platform.extra_context()) platform_context = self.get_context(extra_context=arch_platform.extra_context())
build_type = "Release" 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) 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) logger.info("CMake builds these files, to be included in the package: %s", built_paths)
@@ -1330,7 +1231,7 @@ class Releaser:
logger.info("Collecting files...") logger.info("Collecting files...")
archive_file_tree = ArchiveFileTree() 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"]["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(extra_context=extra_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)
logger.info("Creating %s", zip_path) logger.info("Creating %s", zip_path)
with Archiver(zip_path=zip_path) as archiver: with Archiver(zip_path=zip_path) as archiver:
@@ -1345,10 +1246,6 @@ class Releaser:
zip_path = self.dist_path / f"{self.project}-devel-{self.version}-VC.zip" zip_path = self.dist_path / f"{self.project}-devel-{self.version}-VC.zip"
arc_root = f"{self.project}-{self.version}" arc_root = f"{self.project}-{self.version}"
def copy_files_devel(ctx):
archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["files-devel"], file_mapping_root=self.root, context=ctx, time=self.arc_time)
logger.info("Collecting files...") logger.info("Collecting files...")
archive_file_tree = ArchiveFileTree() archive_file_tree = ArchiveFileTree()
if "msbuild" in self.release_info["msvc"]: if "msbuild" in self.release_info["msvc"]:
@@ -1356,13 +1253,12 @@ class Releaser:
arch_platform = self._arch_to_vs_platform(arch=arch) arch_platform = self._arch_to_vs_platform(arch=arch)
platform_context = self.get_context(arch_platform.extra_context()) platform_context = self.get_context(arch_platform.extra_context())
archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["msbuild"]["files-devel"], file_mapping_root=self.root, context=platform_context, time=self.arc_time) archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["msbuild"]["files-devel"], file_mapping_root=self.root, context=platform_context, time=self.arc_time)
copy_files_devel(ctx=platform_context)
if "cmake" in self.release_info["msvc"]: if "cmake" in self.release_info["msvc"]:
for arch in self.release_info["msvc"]["cmake"]["archs"]: for arch in self.release_info["msvc"]["cmake"]["archs"]:
arch_platform = self._arch_to_vs_platform(arch=arch) arch_platform = self._arch_to_vs_platform(arch=arch)
platform_context = self.get_context(arch_platform.extra_context()) platform_context = self.get_context(arch_platform.extra_context())
archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["cmake"]["files-devel"], file_mapping_root=self._arch_platform_to_install_path(arch_platform), context=platform_context, time=self.arc_time) archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["cmake"]["files-devel"], file_mapping_root=self._arch_platform_to_install_path(arch_platform), context=platform_context, time=self.arc_time)
copy_files_devel(ctx=platform_context) archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["files-devel"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
with Archiver(zip_path=zip_path) as archiver: with Archiver(zip_path=zip_path) as archiver:
archive_file_tree.add_to_archiver(archive_base="", archiver=archiver) archive_file_tree.add_to_archiver(archive_base="", archiver=archiver)
@@ -1394,7 +1290,7 @@ def main(argv=None) -> int:
parser.add_argument("--actions", choices=["download", "source", "android", "mingw", "msvc", "dmg"], required=True, nargs="+", dest="actions", help="What to do?") parser.add_argument("--actions", choices=["download", "source", "android", "mingw", "msvc", "dmg"], required=True, nargs="+", dest="actions", help="What to do?")
parser.set_defaults(loglevel=logging.INFO) parser.set_defaults(loglevel=logging.INFO)
parser.add_argument('--vs-year', dest="vs_year", help="Visual Studio year") parser.add_argument('--vs-year', dest="vs_year", help="Visual Studio year")
parser.add_argument('--android-api', dest="android_api", help="Android API version") parser.add_argument('--android-api', type=int, dest="android_api", help="Android API version")
parser.add_argument('--android-home', dest="android_home", default=os.environ.get("ANDROID_HOME"), help="Android Home folder") parser.add_argument('--android-home', dest="android_home", default=os.environ.get("ANDROID_HOME"), help="Android Home folder")
parser.add_argument('--android-ndk-home', dest="android_ndk_home", default=os.environ.get("ANDROID_NDK_HOME"), help="Android NDK Home folder") parser.add_argument('--android-ndk-home', dest="android_ndk_home", default=os.environ.get("ANDROID_NDK_HOME"), help="Android NDK Home folder")
parser.add_argument('--cmake-generator', dest="cmake_generator", default="Ninja", help="CMake Generator") parser.add_argument('--cmake-generator', dest="cmake_generator", default="Ninja", help="CMake Generator")
@@ -1521,27 +1417,14 @@ def main(argv=None) -> int:
if args.android_api is None: if args.android_api is None:
with section_printer.group("Detect Android APIS"): with section_printer.group("Detect Android APIS"):
args.android_api = releaser._detect_android_api(android_home=args.android_home) args.android_api = releaser._detect_android_api(android_home=args.android_home)
else: if args.android_api is None or not (Path(args.android_home) / f"platforms/android-{args.android_api}").is_dir():
try:
android_api_ints = tuple(int(v) for v in args.android_api.split("."))
match len(android_api_ints):
case 1: android_api_name = f"android-{android_api_ints[0]}"
case 2: android_api_name = f"android-{android_api_ints[0]}-ext-{android_api_ints[1]}"
case _: raise ValueError
except ValueError:
logger.error("Invalid --android-api, must be a 'X' or 'X.Y' version")
args.android_api = AndroidApiVersion(ints=android_api_ints, name=android_api_name)
if args.android_api is None:
parser.error("Invalid --android-api, and/or could not be detected") parser.error("Invalid --android-api, and/or could not be detected")
android_api_path = Path(args.android_home) / f"platforms/{args.android_api.name}"
if not android_api_path.is_dir():
logger.warning(f"Android API directory does not exist ({android_api_path})")
with section_printer.group("Android arguments"): with section_printer.group("Android arguments"):
print(f"android_home = {args.android_home}") print(f"android_home = {args.android_home}")
print(f"android_ndk_home = {args.android_ndk_home}") print(f"android_ndk_home = {args.android_ndk_home}")
print(f"android_api = {args.android_api}") print(f"android_api = {args.android_api}")
releaser.create_android_archives( releaser.create_android_archives(
android_api=args.android_api.ints[0], android_api=args.android_api,
android_home=args.android_home, android_home=args.android_home,
android_ndk_home=args.android_ndk_home, android_ndk_home=args.android_ndk_home,
) )

View File

@@ -1,10 +1,10 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright 1992-2025 Free Software Foundation, Inc. # Copyright 1992-2024 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale # shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2025-07-10' timestamp='2024-01-01'
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ version="\
GNU config.guess ($timestamp) GNU config.guess ($timestamp)
Originally written by Per Bothner. Originally written by Per Bothner.
Copyright 1992-2025 Free Software Foundation, Inc. Copyright 1992-2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,7 +123,7 @@ set_cc_for_build() {
dummy=$tmp/dummy dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c" ,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c17 c99 c89 ; do for driver in cc gcc c89 c99 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver CC_FOR_BUILD=$driver
break break
@@ -634,7 +634,6 @@ EOF
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
int
main() main()
{ {
if (!__power_pc()) if (!__power_pc())
@@ -719,8 +718,7 @@ EOF
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
int int main ()
main ()
{ {
#if defined(_SC_KERNEL_BITS) #if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS); long bits = sysconf(_SC_KERNEL_BITS);
@@ -1597,11 +1595,8 @@ EOF
*:Unleashed:*:*) *:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;; ;;
x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*) *:Ironclad:*:*)
GUESS=$UNAME_MACHINE-pc-ironclad-mlibc GUESS=$UNAME_MACHINE-unknown-ironclad
;;
*:[Ii]ronclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc
;; ;;
esac esac
@@ -1626,7 +1621,6 @@ cat > "$dummy.c" <<EOF
#endif #endif
#endif #endif
#endif #endif
int
main () main ()
{ {
#if defined (sony) #if defined (sony)
@@ -1811,8 +1805,8 @@ fi
exit 1 exit 1
# Local variables: # Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp nil t) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='" # time-stamp-start: "timestamp='"
# time-stamp-format: "%Y-%02m-%02d" # time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'" # time-stamp-end: "'"
# End: # End:

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -395,7 +395,7 @@ int main(void)
printf( printf(
"/*\n" "/*\n"
" Simple DirectMedia Layer\n" " Simple DirectMedia Layer\n"
" Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>\n" " Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
"\n" "\n"
" This software is provided 'as-is', without any express or implied\n" " This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n" " warranty. In no event will the authors be held liable for any damages\n"

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -113,7 +113,7 @@ int main(void)
printf( printf(
"/*\n" "/*\n"
" Simple DirectMedia Layer\n" " Simple DirectMedia Layer\n"
" Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>\n" " Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>\n"
"\n" "\n"
" This software is provided 'as-is', without any express or implied\n" " This software is provided 'as-is', without any express or implied\n"
" warranty. In no event will the authors be held liable for any damages\n" " warranty. In no event will the authors be held liable for any damages\n"

View File

@@ -2415,10 +2415,10 @@ libtool_validate_options ()
# preserve --debug # preserve --debug
test : = "$debug_cmd" || func_append preserve_args " --debug" test : = "$debug_cmd" || func_append preserve_args " --debug"
case $host_os in case $host in
# Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
# see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
cygwin* | mingw* | windows* | pw32* | cegcc* | solaris2* | os2*) *cygwin* | *mingw* | *windows* | *pw32* | *cegcc* | *solaris2* | *os2*)
# don't eliminate duplications in $postdeps and $predeps # don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=: opt_duplicate_compiler_generated_deps=:
;; ;;
@@ -4935,7 +4935,7 @@ func_win32_libid ()
*ar\ archive*) # could be an import, or static *ar\ archive*) # could be an import, or static
# Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
$EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' >/dev/null; then $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
case $nm_interface in case $nm_interface in
"MS dumpbin") "MS dumpbin")
if func_cygming_ms_implib_p "$1" || if func_cygming_ms_implib_p "$1" ||
@@ -5534,7 +5534,7 @@ EOF
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if defined _WIN32 && !defined __GNUC__ #ifdef _MSC_VER
# include <direct.h> # include <direct.h>
# include <process.h> # include <process.h>
# include <io.h> # include <io.h>
@@ -6501,7 +6501,7 @@ func_mode_link ()
# we shouldn't force the makefile maintainer to figure out # we shouldn't force the makefile maintainer to figure out
# what system we are compiling for in order to pass an extra # what system we are compiling for in order to pass an extra
# flag for every libtool invocation. # flag for every libtool invocation.
# SDL customization: SDL code doesn't have any undefined symbols. # SDL customization: SDL code doesn't have any undefined symbols
allow_undefined=no allow_undefined=no
# FIXME: Unfortunately, there are problems with the above when trying # FIXME: Unfortunately, there are problems with the above when trying
@@ -6509,7 +6509,7 @@ func_mode_link ()
# even a static library is built. For now, we need to specify # even a static library is built. For now, we need to specify
# -no-undefined on the libtool link line when we can be certain # -no-undefined on the libtool link line when we can be certain
# that all symbols are satisfied, otherwise we get a static library. # that all symbols are satisfied, otherwise we get a static library.
# SDL customization: SDL code doesn't have any undefined symbols. # SDL customization: SDL code doesn't have any undefined symbols
# allow_undefined=yes # allow_undefined=yes
;; ;;
*) *)
@@ -7096,7 +7096,7 @@ func_mode_link ()
continue continue
;; ;;
-mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \ -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg" func_append compiler_flags " $arg"
func_append compile_command " $arg" func_append compile_command " $arg"
func_append finalize_command " $arg" func_append finalize_command " $arg"
@@ -7310,10 +7310,7 @@ func_mode_link ()
# -fno-sanitize* Clang/GCC memory and address sanitizer # -fno-sanitize* Clang/GCC memory and address sanitizer
# -shared-libsan Link with shared sanitizer runtimes (Clang) # -shared-libsan Link with shared sanitizer runtimes (Clang)
# -static-libsan Link with static sanitizer runtimes (Clang) # -static-libsan Link with static sanitizer runtimes (Clang)
# -no-canonical-prefixes Do not expand any symbolic links
# -fuse-ld=* Linker select flags for GCC # -fuse-ld=* Linker select flags for GCC
# -static-* direct GCC to link specific libraries statically
# -fcilkplus Cilk Plus language extension features for C/C++
# -rtlib=* select c runtime lib with clang # -rtlib=* select c runtime lib with clang
# --unwindlib=* select unwinder library with clang # --unwindlib=* select unwinder library with clang
# -f{file|debug|macro|profile}-prefix-map=* needed for lto linking # -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
@@ -7321,12 +7318,12 @@ func_mode_link ()
# -Werror, -Werror=* Report (specified) warnings as errors # -Werror, -Werror=* Report (specified) warnings as errors
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-no-canonical-prefixes| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*| \
-stdlib=*|-rtlib=*|--unwindlib=*| \ -stdlib=*|-rtlib=*|--unwindlib=*| \
-specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \ -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
-ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \ -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
-fdiagnostics-color*|-frecord-gcc-switches| \ -fdiagnostics-color*|-frecord-gcc-switches| \
-fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*) -fuse-ld=*|-Wa,*|-Werror|-Werror=*)
func_quote_for_eval "$arg" func_quote_for_eval "$arg"
arg=$func_quote_for_eval_result arg=$func_quote_for_eval_result
func_append compile_command " $arg" func_append compile_command " $arg"
@@ -7656,7 +7653,7 @@ func_mode_link ()
found=false found=false
case $deplib in case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*) |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test prog,link = "$linkmode,$pass"; then if test prog,link = "$linkmode,$pass"; then
compile_deplibs="$deplib $compile_deplibs" compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs" finalize_deplibs="$deplib $finalize_deplibs"
@@ -8182,8 +8179,8 @@ func_mode_link ()
fi fi
if test -n "$library_names" && if test -n "$library_names" &&
{ test no = "$use_static_libs" || test -z "$old_library"; }; then { test no = "$use_static_libs" || test -z "$old_library"; }; then
case $host_os in case $host in
cygwin* | mingw* | windows* | cegcc* | os2*) *cygwin* | *mingw* | *windows* | *cegcc* | *os2*)
# No point in relinking DLLs because paths are not encoded # No point in relinking DLLs because paths are not encoded
func_append notinst_deplibs " $lib" func_append notinst_deplibs " $lib"
need_relink=no need_relink=no
@@ -8252,8 +8249,8 @@ func_mode_link ()
soname=$dlname soname=$dlname
elif test -n "$soname_spec"; then elif test -n "$soname_spec"; then
# bleh windows # bleh windows
case $host_os in case $host in
cygwin* | mingw* | windows* | cegcc*) # | os2* # SDL customization: removed OS/2 versioning support. *cygwin* | mingw* | *windows* | *cegcc*) # | *os2* # SDL customization: removed OS/2 versioning support.
func_arith $current - $age func_arith $current - $age
major=$func_arith_result major=$func_arith_result
versuffix=-$major versuffix=-$major
@@ -8395,7 +8392,7 @@ func_mode_link ()
test no = "$hardcode_direct_absolute"; then test no = "$hardcode_direct_absolute"; then
add=$libdir/$linklib add=$libdir/$linklib
elif test yes = "$hardcode_minus_L"; then elif test yes = "$hardcode_minus_L"; then
add_dir=-L$lt_sysroot$libdir add_dir=-L$libdir
add=-l$name add=-l$name
elif test yes = "$hardcode_shlibpath_var"; then elif test yes = "$hardcode_shlibpath_var"; then
case :$finalize_shlibpath: in case :$finalize_shlibpath: in
@@ -8412,7 +8409,7 @@ func_mode_link ()
fi fi
else else
# We cannot seem to hardcode it, guess we'll fake it. # We cannot seem to hardcode it, guess we'll fake it.
add_dir=-L$lt_sysroot$libdir add_dir=-L$libdir
# Try looking first in the location we're being installed to. # Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then if test -n "$inst_prefix_dir"; then
case $libdir in case $libdir in
@@ -8683,7 +8680,7 @@ func_mode_link ()
test CXX = "$tagname" && { test CXX = "$tagname" && {
case $host_os in case $host_os in
linux*) linux*)
case `$CC -V 2>&1 | $SED 5q` in case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C++ 5.9 *Sun\ C*) # Sun C++ 5.9
func_suncc_cstd_abi func_suncc_cstd_abi
@@ -8856,13 +8853,13 @@ func_mode_link ()
# #
case $version_type in case $version_type in
# correct linux to gnu/linux during the next big refactor # correct linux to gnu/linux during the next big refactor
darwin|freebsd-elf|linux|midnightbsd-elf|osf|qnx|windows|none) darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none)
func_arith $number_major + $number_minor func_arith $number_major + $number_minor
current=$func_arith_result current=$func_arith_result
age=$number_minor age=$number_minor
revision=$number_revision revision=$number_revision
;; ;;
freebsd-aout|sco|sunos) freebsd-aout|qnx|sco|sunos)
current=$number_major current=$number_major
revision=$number_minor revision=$number_minor
age=0 age=0
@@ -9009,9 +9006,8 @@ func_mode_link ()
;; ;;
qnx) qnx)
func_arith $current - $age major=.$current
major=.$func_arith_result versuffix=.$current
versuffix=$major.$age.$revision
;; ;;
sco) sco)

0
build-scripts/setup-gdk-desktop.py Normal file → Executable file
View File

View File

@@ -5,8 +5,8 @@
SDL_ROOT=$(dirname $0)/.. SDL_ROOT=$(dirname $0)/..
cd $SDL_ROOT cd $SDL_ROOT
if [ -e ./REVISION.txt ]; then if [ -e ./VERSION.txt ]; then
cat ./REVISION.txt cat ./VERSION.txt
exit 0 exit 0
fi fi

View File

@@ -29,7 +29,7 @@ done
rev=`sh showrev.sh 2>/dev/null` rev=`sh showrev.sh 2>/dev/null`
if [ "$rev" != "" ]; then if [ "$rev" != "" ]; then
if [ -n "$dist" ]; then if [ -n "$dist" ]; then
echo "$rev" > "$outdir/REVISION.txt" echo "$rev" > "$outdir/VERSION.txt"
fi fi
echo "/* Generated by updaterev.sh, do not edit */" >"$header.new" echo "/* Generated by updaterev.sh, do not edit */" >"$header.new"
if [ -n "$vendor" ]; then if [ -n "$vendor" ]; then

File diff suppressed because it is too large Load Diff

View File

@@ -27,13 +27,11 @@ function(check_cpu_architecture ARCH VARIABLE)
if(ARCH STREQUAL "x86") if(ARCH STREQUAL "x86")
_internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE}) _internal_check_cpu_architecture("defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" x86 ${VARIABLE})
elseif(ARCH STREQUAL "x64") elseif(ARCH STREQUAL "x64")
_internal_check_cpu_architecture("(defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)) && !defined(_M_ARM64EC)" x64 ${VARIABLE}) _internal_check_cpu_architecture("defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" x64 ${VARIABLE})
elseif(ARCH STREQUAL "arm32") elseif(ARCH STREQUAL "arm32")
_internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE}) _internal_check_cpu_architecture("defined(__arm__) || defined(_M_ARM)" arm32 ${VARIABLE})
elseif(ARCH STREQUAL "arm64") elseif(ARCH STREQUAL "arm64")
_internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE}) _internal_check_cpu_architecture("defined(__aarch64__) || defined(_M_ARM64)" arm64 ${VARIABLE})
elseif(ARCH STREQUAL "arm64ec")
_internal_check_cpu_architecture("defined(_M_ARM64EC)" arm64ec ${VARIABLE})
elseif(ARCH STREQUAL "loongarch64") elseif(ARCH STREQUAL "loongarch64")
_internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE}) _internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE})
else() else()

View File

@@ -119,7 +119,7 @@ macro(CheckALSA)
endif() endif()
endif() endif()
if(NOT HAVE_ALSA_SHARED) if(NOT HAVE_ALSA_SHARED)
list(APPEND CMAKE_LIBS ALSA::ALSA) list(APPEND CMAKE_DEPENDS ALSA::ALSA)
list(APPEND PKGCONFIG_DEPENDS alsa) list(APPEND PKGCONFIG_DEPENDS alsa)
endif() endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
@@ -947,7 +947,7 @@ macro(CheckPTHREAD)
elseif(BSDI) elseif(BSDI)
set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE") set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
set(PTHREAD_LDFLAGS "") set(PTHREAD_LDFLAGS "")
elseif(MACOS) elseif(DARWIN)
set(PTHREAD_CFLAGS "-D_THREAD_SAFE") set(PTHREAD_CFLAGS "-D_THREAD_SAFE")
# causes Carbon.p complaints? # causes Carbon.p complaints?
# set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE") # set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
@@ -963,11 +963,7 @@ macro(CheckPTHREAD)
set(PTHREAD_LDFLAGS "-lpthread") set(PTHREAD_LDFLAGS "-lpthread")
elseif(SOLARIS) elseif(SOLARIS)
set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_CFLAGS "-D_REENTRANT")
if(CMAKE_C_COMPILER_ID MATCHES "SunPro") set(PTHREAD_LDFLAGS "-pthread -lposix4")
set(PTHREAD_LDFLAGS "-mt -lpthread")
else()
set(PTHREAD_LDFLAGS "-pthread")
endif()
elseif(SYSV5) elseif(SYSV5)
set(PTHREAD_CFLAGS "-D_REENTRANT -Kthread") set(PTHREAD_CFLAGS "-D_REENTRANT -Kthread")
set(PTHREAD_LDFLAGS "") set(PTHREAD_LDFLAGS "")
@@ -1253,7 +1249,6 @@ macro(CheckHIDAPI)
if(HAVE_HIDAPI) if(HAVE_HIDAPI)
if(ANDROID) if(ANDROID)
enable_language(CXX)
list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp) list(APPEND SOURCE_FILES ${SDL2_SOURCE_DIR}/src/hidapi/android/hid.cpp)
endif() endif()
if(IOS OR TVOS) if(IOS OR TVOS)
@@ -1281,18 +1276,13 @@ endmacro()
# - n/a # - n/a
macro(CheckRPI) macro(CheckRPI)
if(SDL_RPI) if(SDL_RPI)
pkg_check_modules(VIDEO_RPI bcm_host) pkg_check_modules(VIDEO_RPI bcm_host brcmegl)
if (NOT VIDEO_RPI_FOUND) if (NOT VIDEO_RPI_FOUND)
set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" )
set(VIDEO_RPI_LIBRARIES bcm_host ) set(VIDEO_RPI_LIBRARIES bcm_host )
set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib")
endif() endif()
pkg_check_modules(VIDEO_RPI_EGL brcmegl)
if (NOT VIDEO_RPI_EGL_FOUND)
set(VIDEO_RPI_EGL_LDFLAGS "-Wl,-rpath,/opt/vc/lib")
endif()
listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
@@ -1301,7 +1291,9 @@ macro(CheckRPI)
set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}") set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}")
check_c_source_compiles(" check_c_source_compiles("
#include <bcm_host.h> #include <bcm_host.h>
#include <EGL/eglplatform.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
EGL_DISPMANX_WINDOW_T window;
bcm_host_init(); bcm_host_init();
}" HAVE_RPI) }" HAVE_RPI)
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
@@ -1315,7 +1307,7 @@ macro(CheckRPI)
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
# !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right? # !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right?
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS} ${VIDEO_RPI_EGL_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
endif() endif()
endif() endif()
endmacro() endmacro()

View File

@@ -32,8 +32,10 @@ macro(SDL_DetectCMakePlatform)
set(SDL_CMAKE_PLATFORM QNX) set(SDL_CMAKE_PLATFORM QNX)
endif() endif()
elseif(APPLE) elseif(APPLE)
if(CMAKE_SYSTEM_NAME MATCHES ".*(Darwin|MacOS).*") if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
set(SDL_CMAKE_PLATFORM MACOS) set(SDL_CMAKE_PLATFORM DARWIN)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
set(SDL_CMAKE_PLATFORM MACOSX)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*") elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
set(SDL_CMAKE_PLATFORM TVOS) set(SDL_CMAKE_PLATFORM TVOS)
elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*") elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
@@ -41,10 +43,6 @@ macro(SDL_DetectCMakePlatform)
if(CMAKE_VERSION VERSION_LESS 3.14) if(CMAKE_VERSION VERSION_LESS 3.14)
set(SDL_CMAKE_PLATFORM IOS) set(SDL_CMAKE_PLATFORM IOS)
endif() endif()
elseif(CMAKE_SYSTEM_NAME MATCHES ".*watchOS.*")
set(SDL_CMAKE_PLATFORM WATCHOS)
elseif (CMAKE_SYSTEM_NAME MATCHES "visionOS")
set(SDL_CMAKE_PLATFORM VISIONOS)
endif() endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*") elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
message_error("BeOS support has been removed as of SDL 2.0.2.") message_error("BeOS support has been removed as of SDL 2.0.2.")

View File

@@ -3,8 +3,6 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(sdl_test LANGUAGES C) project(sdl_test LANGUAGES C)
include(CheckLanguage)
include(FeatureSummary)
include(GenerateExportHeader) include(GenerateExportHeader)
if(ANDROID) if(ANDROID)
@@ -21,6 +19,8 @@ cmake_policy(SET CMP0074 NEW)
# Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot # Override CMAKE_FIND_ROOT_PATH_MODE to allow search for SDL2 outside of sysroot
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER)
include(FeatureSummary)
option(TEST_SHARED "Test linking to shared SDL2 library" ON) option(TEST_SHARED "Test linking to shared SDL2 library" ON)
add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library") add_feature_info("TEST_SHARED" TEST_SHARED "Test linking with shared library")
@@ -33,19 +33,6 @@ add_feature_info("TEST_TEST" TEST_STATIC "Test linking to SDL test library")
option(TEST_FULL "Run complete SDL test suite" OFF) option(TEST_FULL "Run complete SDL test suite" OFF)
add_feature_info("TEST_FULL" TEST_FULL "Build full SDL testsuite") add_feature_info("TEST_FULL" TEST_FULL "Build full SDL testsuite")
# FIXME: how to target ios/tvos with Swift?
# https://gitlab.kitware.com/cmake/cmake/-/issues/20104
if(APPLE AND CMAKE_SYSTEM_NAME MATCHES ".*(Darwin|MacOS).*")
# multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift
list(LENGTH CMAKE_OSX_ARCHITECTURES count_osx_archs)
if(count_osx_archs LESS_EQUAL 1)
check_language(Swift)
if(CMAKE_Swift_COMPILER)
enable_language(Swift)
endif()
endif()
endif()
if(TEST_SHARED) if(TEST_SHARED)
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2) find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2)
if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE)) if(EMSCRIPTEN OR (WIN32 AND NOT WINDOWS_STORE))
@@ -99,12 +86,6 @@ if(TEST_SHARED)
add_executable(sdltest-shared sdltest.c) add_executable(sdltest-shared sdltest.c)
target_link_libraries(sdltest-shared PRIVATE SDL2::SDL2main SDL2::SDL2test SDL2::SDL2) target_link_libraries(sdltest-shared PRIVATE SDL2::SDL2main SDL2::SDL2test SDL2::SDL2)
endif() endif()
if(CMAKE_Swift_COMPILER)
add_executable(swift-shared main.swift)
target_include_directories(swift-shared PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift")
target_link_libraries(swift-shared PRIVATE SDL2::SDL2)
endif()
endif() endif()
if(TEST_STATIC) if(TEST_STATIC)
@@ -142,11 +123,6 @@ if(TEST_STATIC)
target_include_directories(cli-static-vars PRIVATE ${SDL2_INCLUDE_DIRS}) target_include_directories(cli-static-vars PRIVATE ${SDL2_INCLUDE_DIRS})
endif() endif()
if(TEST_TEST)
add_executable(sdltest-static sdltest.c)
target_link_libraries(sdltest-static PRIVATE SDL2::SDL2main SDL2::SDL2test SDL2::SDL2-static)
endif()
if(CMAKE_Swift_COMPILER) if(CMAKE_Swift_COMPILER)
add_executable(swift-static main.swift) add_executable(swift-static main.swift)
target_include_directories(swift-static PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift") target_include_directories(swift-static PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift")

View File

@@ -1,12 +0,0 @@
/* Contributed by Piotr Usewicz (https://github.com/pusewicz) */
import SDL2
guard SDL_Init(Uint32(SDL_INIT_VIDEO)) == 0 else {
fatalError("SDL_Init error: \(String(cString: SDL_GetError()))")
}
var sdlVersion = SDL_version()
SDL_GetVersion(&sdlVersion)
print("SDL version: \(sdlVersion.major).\(sdlVersion.minor).\(sdlVersion.patch)")

View File

@@ -1,4 +0,0 @@
module SDL2 [extern_c] {
header "shim.h"
export *
}

View File

@@ -1,3 +0,0 @@
/* Contributed by Piotr Usewicz (https://github.com/pusewicz) */
#include "SDL.h"

225
configure vendored
View File

@@ -703,8 +703,6 @@ X_LIBS
X_PRE_LIBS X_PRE_LIBS
X_CFLAGS X_CFLAGS
XMKMF XMKMF
RPI_EGL_LIBS
RPI_EGL_CFLAGS
RPI_LIBS RPI_LIBS
RPI_CFLAGS RPI_CFLAGS
DECOR_LIBS DECOR_LIBS
@@ -993,8 +991,6 @@ DECOR_CFLAGS
DECOR_LIBS DECOR_LIBS
RPI_CFLAGS RPI_CFLAGS
RPI_LIBS RPI_LIBS
RPI_EGL_CFLAGS
RPI_EGL_LIBS
XMKMF XMKMF
DIRECTFB_CFLAGS DIRECTFB_CFLAGS
DIRECTFB_LIBS DIRECTFB_LIBS
@@ -1722,7 +1718,7 @@ Optional Features:
[default=yes] [default=yes]
--enable-libdecor-shared --enable-libdecor-shared
dynamically load libdecor [default=yes] dynamically load libdecor [default=yes]
--enable-video-rpi use Raspberry Pi 0-3 video driver [default=yes] --enable-video-rpi use Raspberry Pi 2/3 video driver [default=yes]
--enable-video-x11 use X11 video driver [default=maybe] --enable-video-x11 use X11 video driver [default=maybe]
--enable-x11-shared dynamically load X11 support [default=maybe] --enable-x11-shared dynamically load X11 support [default=maybe]
--enable-video-x11-xcursor --enable-video-x11-xcursor
@@ -1852,10 +1848,6 @@ Some influential environment variables:
DECOR_LIBS linker flags for DECOR, overriding pkg-config DECOR_LIBS linker flags for DECOR, overriding pkg-config
RPI_CFLAGS C compiler flags for RPI, overriding pkg-config RPI_CFLAGS C compiler flags for RPI, overriding pkg-config
RPI_LIBS linker flags for RPI, overriding pkg-config RPI_LIBS linker flags for RPI, overriding pkg-config
RPI_EGL_CFLAGS
C compiler flags for RPI_EGL, overriding pkg-config
RPI_EGL_LIBS
linker flags for RPI_EGL, overriding pkg-config
XMKMF Path to xmkmf, Makefile generator for X Window System XMKMF Path to xmkmf, Makefile generator for X Window System
DIRECTFB_CFLAGS DIRECTFB_CFLAGS
C compiler flags for DIRECTFB, overriding pkg-config C compiler flags for DIRECTFB, overriding pkg-config
@@ -3515,8 +3507,8 @@ orig_CFLAGS="$CFLAGS"
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=33 SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=0 SDL_MICRO_VERSION=10
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
@@ -5815,7 +5807,7 @@ cygwin*)
# func_win32_libid is a shell function defined in ltmain.sh # func_win32_libid is a shell function defined in ltmain.sh
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid' lt_cv_file_magic_cmd='func_win32_libid'
lt_cv_deplibs_check_method=pass_all # SDL customization. lt_cv_deplibs_check_method=pass_all # SDL customization
;; ;;
mingw* | windows* | pw32*) mingw* | windows* | pw32*)
@@ -5827,10 +5819,10 @@ mingw* | windows* | pw32*)
lt_cv_file_magic_cmd='func_win32_libid' lt_cv_file_magic_cmd='func_win32_libid'
else else
# Keep this pattern in sync with the one in func_win32_libid. # Keep this pattern in sync with the one in func_win32_libid.
lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
lt_cv_file_magic_cmd='$OBJDUMP -f' lt_cv_file_magic_cmd='$OBJDUMP -f'
fi fi
lt_cv_deplibs_check_method=pass_all # SDL customization. lt_cv_deplibs_check_method=pass_all # SDL customization
;; ;;
cegcc*) cegcc*)
@@ -6836,7 +6828,7 @@ void nm_test_func(void){}
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
int main(void){nm_test_var='a';nm_test_func();return(0);} int main(){nm_test_var='a';nm_test_func();return(0);}
_LT_EOF _LT_EOF
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -8098,43 +8090,6 @@ fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; }
# Feature test to disable chained fixups since it is not
# compatible with '-undefined dynamic_lookup'
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -no_fixup_chains linker flag" >&5
printf %s "checking for -no_fixup_chains linker flag... " >&6; }
if test ${lt_cv_support_no_fixup_chains+y}
then :
printf %s "(cached) " >&6
else $as_nop
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,-no_fixup_chains"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main (void)
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
lt_cv_support_no_fixup_chains=yes
else $as_nop
lt_cv_support_no_fixup_chains=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_support_no_fixup_chains" >&5
printf "%s\n" "$lt_cv_support_no_fixup_chains" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
printf %s "checking for -exported_symbols_list linker flag... " >&6; } printf %s "checking for -exported_symbols_list linker flag... " >&6; }
if test ${lt_cv_ld_exported_symbols_list+y} if test ${lt_cv_ld_exported_symbols_list+y}
@@ -8187,7 +8142,7 @@ _LT_EOF
echo "$RANLIB libconftest.a" >&5 echo "$RANLIB libconftest.a" >&5
$RANLIB libconftest.a 2>&5 $RANLIB libconftest.a 2>&5
cat > conftest.c << _LT_EOF cat > conftest.c << _LT_EOF
int main(void) { return 0;} int main() { return 0;}
_LT_EOF _LT_EOF
echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
@@ -8215,12 +8170,7 @@ printf "%s\n" "$lt_cv_ld_force_load" >&6; }
10.[012],*|,*powerpc*-darwin[5-8]*) 10.[012],*|,*powerpc*-darwin[5-8]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*) *)
if test yes = "$lt_cv_support_no_fixup_chains"; then _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup $wl-no_fixup_chains'
else
_lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup'
fi
;;
esac esac
;; ;;
esac esac
@@ -9120,7 +9070,7 @@ objext=$objext
lt_simple_compile_test_code="int some_variable = 0;" lt_simple_compile_test_code="int some_variable = 0;"
# Code to be used in simple link tests # Code to be used in simple link tests
lt_simple_link_test_code='int main(void){return(0);}' lt_simple_link_test_code='int main(){return(0);}'
@@ -11600,14 +11550,14 @@ cygwin* | mingw* | windows* | pw32* | cegcc*)
cygwin*) cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib' # Cygwin DLLs use 'cyg' prefix rather than 'lib'
#soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization
sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
;; ;;
mingw* | windows* | cegcc*) mingw* | windows* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix # MinGW DLLs use traditional 'lib' prefix
#soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization
;; ;;
pw32*) pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib' # pw32 DLLs use 'pw' prefix rather than 'lib'
@@ -12671,11 +12621,11 @@ else
/* When -fvisibility=hidden is used, assume the code has been annotated /* When -fvisibility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */ correspondingly for the symbols needed. */
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord (void) __attribute__((visibility("default"))); int fnord () __attribute__((visibility("default")));
#endif #endif
int fnord (void) { return 42; } int fnord () { return 42; }
int main (void) int main ()
{ {
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown; int status = $lt_dlunknown;
@@ -12778,11 +12728,11 @@ else
/* When -fvisibility=hidden is used, assume the code has been annotated /* When -fvisibility=hidden is used, assume the code has been annotated
correspondingly for the symbols needed. */ correspondingly for the symbols needed. */
#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
int fnord (void) __attribute__((visibility("default"))); int fnord () __attribute__((visibility("default")));
#endif #endif
int fnord (void) { return 42; } int fnord () { return 42; }
int main (void) int main ()
{ {
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
int status = $lt_dlunknown; int status = $lt_dlunknown;
@@ -16984,13 +16934,13 @@ cygwin* | mingw* | windows* | pw32* | cegcc*)
cygwin*) cygwin*)
# Cygwin DLLs use 'cyg' prefix rather than 'lib' # Cygwin DLLs use 'cyg' prefix rather than 'lib'
#soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization
;; ;;
mingw* | windows* | cegcc*) mingw* | windows* | cegcc*)
# MinGW DLLs use traditional 'lib' prefix # MinGW DLLs use traditional 'lib' prefix
#soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization. soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization
;; ;;
pw32*) pw32*)
# pw32 DLLs use 'pw' prefix rather than 'lib' # pw32 DLLs use 'pw' prefix rather than 'lib'
@@ -19755,12 +19705,6 @@ if test "x$ac_cv_func_sigaction" = xyes
then : then :
printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h printf "%s\n" "#define HAVE_SIGACTION 1" >>confdefs.h
fi
ac_fn_c_check_func "$LINENO" "sigtimedwait" "ac_cv_func_sigtimedwait"
if test "x$ac_cv_func_sigtimedwait" = xyes
then :
printf "%s\n" "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
fi fi
ac_fn_c_check_func "$LINENO" "setjmp" "ac_cv_func_setjmp" ac_fn_c_check_func "$LINENO" "setjmp" "ac_cv_func_setjmp"
if test "x$ac_cv_func_setjmp" = xyes if test "x$ac_cv_func_setjmp" = xyes
@@ -22428,6 +22372,7 @@ printf %s "checking for NAS audio support... " >&6; }
have_nas=yes have_nas=yes
NAS_CFLAGS="-I/usr/X11R6/include/" NAS_CFLAGS="-I/usr/X11R6/include/"
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
fi fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_nas" >&5
@@ -23675,19 +23620,19 @@ fi
if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
pkg_failed=no pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bcm_host" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bcm_host brcmegl" >&5
printf %s "checking for bcm_host... " >&6; } printf %s "checking for bcm_host brcmegl... " >&6; }
if test -n "$RPI_CFLAGS"; then if test -n "$RPI_CFLAGS"; then
pkg_cv_RPI_CFLAGS="$RPI_CFLAGS" pkg_cv_RPI_CFLAGS="$RPI_CFLAGS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5
($PKG_CONFIG --exists --print-errors "bcm_host") 2>&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host" 2>/dev/null` pkg_cv_RPI_CFLAGS=`$PKG_CONFIG --cflags "bcm_host brcmegl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@@ -23699,12 +23644,12 @@ if test -n "$RPI_LIBS"; then
pkg_cv_RPI_LIBS="$RPI_LIBS" pkg_cv_RPI_LIBS="$RPI_LIBS"
elif test -n "$PKG_CONFIG"; then elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host\""; } >&5 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bcm_host brcmegl\""; } >&5
($PKG_CONFIG --exists --print-errors "bcm_host") 2>&5 ($PKG_CONFIG --exists --print-errors "bcm_host brcmegl") 2>&5
ac_status=$? ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then test $ac_status = 0; }; then
pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host" 2>/dev/null` pkg_cv_RPI_LIBS=`$PKG_CONFIG --libs "bcm_host brcmegl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes pkg_failed=yes
@@ -23725,9 +23670,9 @@ else
_pkg_short_errors_supported=no _pkg_short_errors_supported=no
fi fi
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
RPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bcm_host" 2>&1` RPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bcm_host brcmegl" 2>&1`
else else
RPI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bcm_host" 2>&1` RPI_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bcm_host brcmegl" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$RPI_PKG_ERRORS" >&5 echo "$RPI_PKG_ERRORS" >&5
@@ -23745,92 +23690,13 @@ printf "%s\n" "yes" >&6; }
video_rpi=yes video_rpi=yes
fi fi
pkg_failed=no
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for brcmegl" >&5
printf %s "checking for brcmegl... " >&6; }
if test -n "$RPI_EGL_CFLAGS"; then
pkg_cv_RPI_EGL_CFLAGS="$RPI_EGL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"brcmegl\""; } >&5
($PKG_CONFIG --exists --print-errors "brcmegl") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_RPI_EGL_CFLAGS=`$PKG_CONFIG --cflags "brcmegl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$RPI_EGL_LIBS"; then
pkg_cv_RPI_EGL_LIBS="$RPI_EGL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"brcmegl\""; } >&5
($PKG_CONFIG --exists --print-errors "brcmegl") 2>&5
ac_status=$?
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_RPI_EGL_LIBS=`$PKG_CONFIG --libs "brcmegl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
RPI_EGL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "brcmegl" 2>&1`
else
RPI_EGL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "brcmegl" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$RPI_EGL_PKG_ERRORS" >&5
video_rpi_egl=no
elif test $pkg_failed = untried; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
video_rpi_egl=no
else
RPI_EGL_CFLAGS=$pkg_cv_RPI_EGL_CFLAGS
RPI_EGL_LIBS=$pkg_cv_RPI_EGL_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
video_rpi_egl=yes
fi
if test x$video_rpi = xno; then if test x$video_rpi = xno; then
if test x$ARCH = xnetbsd; then if test x$ARCH = xnetbsd; then
RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
RPI_LIBS="-L/usr/pkg/lib -lbcm_host" RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
else else
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
RPI_LIBS="-L/opt/vc/lib -lbcm_host" RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
fi
fi
if test x$video_rpi_egl = xno; then
if test x$ARCH = xnetbsd; then
RPI_EGL_LIBS="-Wl,-R/usr/pkg/lib"
else
RPI_EGL_LIBS="-Wl,-rpath,/opt/vc/lib"
fi fi
fi fi
@@ -23838,20 +23704,22 @@ fi
ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
# Add the Raspberry Pi compiler flags and libraries # Add the Raspberry Pi compiler flags and libraries
CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_EGL_LIBS $RPI_LIBS" CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 0-3" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi 2/3" >&5
printf %s "checking for Raspberry Pi 0-3... " >&6; } printf %s "checking for Raspberry Pi 2/3... " >&6; }
have_video_rpi=no have_video_rpi=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <bcm_host.h> #include <bcm_host.h>
#include <EGL/eglplatform.h>
int int
main (void) main (void)
{ {
EGL_DISPMANX_WINDOW_T window;
bcm_host_init(); bcm_host_init();
; ;
@@ -23874,7 +23742,7 @@ printf "%s\n" "$have_video_rpi" >&6; }
CFLAGS="$CFLAGS $RPI_CFLAGS" CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_EGL_LIBS $RPI_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
printf "%s\n" "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h printf "%s\n" "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
@@ -26458,9 +26326,6 @@ else $as_nop
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
;; ;;
*-*-solaris*)
enable_video_vulkan=no
;;
*-*-darwin*) *-*-darwin*)
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c" CFLAGS="$CFLAGS -x objective-c"
@@ -28399,7 +28264,6 @@ fi
if test x$hidapi_support = xyes; then if test x$hidapi_support = xyes; then
if test x$have_libusb_h = xyes; then if test x$have_libusb_h = xyes; then
printf "%s\n" "#define HAVE_LIBUSB 1" >>confdefs.h printf "%s\n" "#define HAVE_LIBUSB 1" >>confdefs.h
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
@@ -28747,23 +28611,12 @@ printf "%s\n" "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
case $ARCH in case $ARCH in
sysv5|solaris|hpux) sysv5|solaris|hpux)
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
ac_fn_c_check_header_compile "$LINENO" "sys/audioio.h" "ac_cv_header_sys_audioio_h" "$ac_includes_default"
if test "x$ac_cv_header_sys_audioio_h" = xyes
then :
have_sys_audioio_h=yes
else $as_nop
have_sys_audioio_h=no
fi
if test x$have_sys_audioio_h = xyes; then
printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h printf "%s\n" "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
SUMMARY_audio="${SUMMARY_audio} sun" SUMMARY_audio="${SUMMARY_audio} sun"
have_audio=yes have_audio=yes
fi
;; ;;
netbsd) # Don't use this on OpenBSD, it's busted. netbsd) # Don't use this on OpenBSD, it's busted.

View File

@@ -12,8 +12,8 @@ orig_CFLAGS="$CFLAGS"
dnl Set various version strings - taken gratefully from the GTk sources dnl Set various version strings - taken gratefully from the GTk sources
# See docs/release_checklist.md # See docs/release_checklist.md
SDL_MAJOR_VERSION=2 SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=33 SDL_MINOR_VERSION=30
SDL_MICRO_VERSION=0 SDL_MICRO_VERSION=10
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
@@ -359,7 +359,7 @@ dnl Checks for library functions.
AC_DEFINE(HAVE_MPROTECT, 1, [ ]) AC_DEFINE(HAVE_MPROTECT, 1, [ ])
],[]), ],[]),
) )
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction sigtimedwait setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll memfd_create posix_fallocate _Exit) AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll memfd_create posix_fallocate _Exit)
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
@@ -1247,6 +1247,7 @@ CheckNAS()
have_nas=yes have_nas=yes
NAS_CFLAGS="-I/usr/X11R6/include/" NAS_CFLAGS="-I/usr/X11R6/include/"
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt" NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
fi fi
AC_MSG_RESULT($have_nas) AC_MSG_RESULT($have_nas)
@@ -1847,27 +1848,18 @@ CheckNativeClient()
CheckRPI() CheckRPI()
{ {
AC_ARG_ENABLE(video-rpi, AC_ARG_ENABLE(video-rpi,
[AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi 0-3 video driver [default=yes]])], [AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi 2/3 video driver [default=yes]])],
, enable_video_rpi=yes) , enable_video_rpi=yes)
if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
PKG_CHECK_MODULES([RPI], [bcm_host], video_rpi=yes, video_rpi=no) PKG_CHECK_MODULES([RPI], [bcm_host brcmegl], video_rpi=yes, video_rpi=no)
PKG_CHECK_MODULES([RPI_EGL], [brcmegl], video_rpi_egl=yes, video_rpi_egl=no)
if test x$video_rpi = xno; then if test x$video_rpi = xno; then
if test x$ARCH = xnetbsd; then if test x$ARCH = xnetbsd; then
RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
RPI_LIBS="-L/usr/pkg/lib -lbcm_host" RPI_LIBS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
else else
RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
RPI_LIBS="-L/opt/vc/lib -lbcm_host" RPI_LIBS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host"
fi
fi
if test x$video_rpi_egl = xno; then
if test x$ARCH = xnetbsd; then
RPI_EGL_LIBS="-Wl,-R/usr/pkg/lib"
else
RPI_EGL_LIBS="-Wl,-rpath,/opt/vc/lib"
fi fi
fi fi
@@ -1875,13 +1867,15 @@ CheckRPI()
ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
# Add the Raspberry Pi compiler flags and libraries # Add the Raspberry Pi compiler flags and libraries
CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_EGL_LIBS $RPI_LIBS" CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LIBS"
AC_MSG_CHECKING(for Raspberry Pi 0-3) AC_MSG_CHECKING(for Raspberry Pi 2/3)
have_video_rpi=no have_video_rpi=no
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <bcm_host.h> #include <bcm_host.h>
#include <EGL/eglplatform.h>
]], [[ ]], [[
EGL_DISPMANX_WINDOW_T window;
bcm_host_init(); bcm_host_init();
]])], [have_video_rpi=yes],[]) ]])], [have_video_rpi=yes],[])
AC_MSG_RESULT($have_video_rpi) AC_MSG_RESULT($have_video_rpi)
@@ -1893,7 +1887,7 @@ CheckRPI()
CFLAGS="$CFLAGS $RPI_CFLAGS" CFLAGS="$CFLAGS $RPI_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_EGL_LIBS $RPI_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LIBS"
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
SUMMARY_video="${SUMMARY_video} rpi" SUMMARY_video="${SUMMARY_video} rpi"
@@ -2742,10 +2736,6 @@ CheckVulkan()
#endif #endif
]],[])], [],[enable_video_vulkan=no]) ]],[])], [],[enable_video_vulkan=no])
;; ;;
*-*-solaris*)
dnl Strictly speaking, what's missing here is libxcb. Even without Vulkan support at the OS level, it should still compile if we had that.
enable_video_vulkan=no
;;
*-*-darwin*) *-*-darwin*)
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf dnl Work around that we don't have Objective-C support in autoconf
@@ -3635,7 +3625,7 @@ CheckHIDAPI()
if test x$hidapi_support = xyes; then if test x$hidapi_support = xyes; then
if test x$have_libusb_h = xyes; then if test x$have_libusb_h = xyes; then
AC_DEFINE(HAVE_LIBUSB, 1, [ ]) AC_DEFINE(HAVE_LIBUSB)
EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
if test x$require_hidapi_libusb = xyes; then if test x$require_hidapi_libusb = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
@@ -3868,14 +3858,10 @@ case "$host" in
if test x$enable_audio = xyes; then if test x$enable_audio = xyes; then
case $ARCH in case $ARCH in
sysv5|solaris|hpux) sysv5|solaris|hpux)
# Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
AC_CHECK_HEADER(sys/audioio.h, have_sys_audioio_h=yes, have_sys_audioio_h=no)
if test x$have_sys_audioio_h = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
SUMMARY_audio="${SUMMARY_audio} sun" SUMMARY_audio="${SUMMARY_audio} sun"
have_audio=yes have_audio=yes
fi
;; ;;
netbsd) # Don't use this on OpenBSD, it's busted. netbsd) # Don't use this on OpenBSD, it's busted.
AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])

View File

@@ -257,7 +257,7 @@ Game Center
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run. This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.

View File

@@ -29,7 +29,7 @@ cmake --install build
## Compiling a HelloWorld ## Compiling a HelloWorld
[PSP Hello World](https://pspdev.github.io/basic_programs.html#hello-world) [PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
## To Do ## To Do
- PSP Screen Keyboard - PSP Screen Keyboard

View File

@@ -14,6 +14,7 @@ Works out of box.
Windows: Windows:
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
===========================================================================
Events Events
=========================================================================== ===========================================================================
SDL_FINGERDOWN: SDL_FINGERDOWN:
@@ -38,6 +39,7 @@ Fields:
Same as SDL_FINGERDOWN. Same as SDL_FINGERDOWN.
===========================================================================
Functions Functions
=========================================================================== ===========================================================================
SDL provides the ability to access the underlying SDL_Finger structures. SDL provides the ability to access the underlying SDL_Finger structures.
@@ -74,6 +76,7 @@ A SDL_Finger has the following fields:
The pressure of the touch. The pressure of the touch.
===========================================================================
Notes Notes
=========================================================================== ===========================================================================
For a complete example see test/testgesture.c For a complete example see test/testgesture.c

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -25,6 +25,7 @@
* Main include header for the SDL library * Main include header for the SDL library
*/ */
#ifndef SDL_h_ #ifndef SDL_h_
#define SDL_h_ #define SDL_h_
@@ -69,8 +70,6 @@
extern "C" { extern "C" {
#endif #endif
/* WIKI CATEGORY: Init */
/* As of version 0.5, SDL is loaded dynamically into the application */ /* As of version 0.5, SDL is loaded dynamically into the application */
/** /**
@@ -131,7 +130,7 @@ extern "C" {
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then * call SDL_Quit() to force shutdown). If a subsystem is already loaded then
* this call will increase the ref-count and return. * this call will increase the ref-count and return.
* *
* \param flags subsystem initialization flags. * \param flags subsystem initialization flags
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -61,8 +61,6 @@ assert can have unique static variables associated with it.
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__) #elif defined(__APPLE__) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
#elif defined(__386__) && defined(__WATCOMC__) #elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } } #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
@@ -153,7 +151,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
#define SDL_enabled_assert(condition) \ #define SDL_enabled_assert(condition) \
do { \ do { \
while ( !(condition) ) { \ while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \ static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \ continue; /* go again. */ \
@@ -193,8 +191,8 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
* A callback that fires when an SDL assertion fails. * A callback that fires when an SDL assertion fails.
* *
* \param data a pointer to the SDL_AssertData structure corresponding to the * \param data a pointer to the SDL_AssertData structure corresponding to the
* current assertion. * current assertion
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler(). * \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
* \returns an SDL_AssertState value indicating how to handle the failure. * \returns an SDL_AssertState value indicating how to handle the failure.
*/ */
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
@@ -214,8 +212,8 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
* *
* \param handler the SDL_AssertionHandler function to call when an assertion * \param handler the SDL_AssertionHandler function to call when an assertion
* fails or NULL for the default handler. * fails or NULL for the default handler
* \param userdata a pointer that is passed to `handler`. * \param userdata a pointer that is passed to `handler`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -256,7 +254,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void
* data, it is safe to pass a NULL pointer to this function to ignore it. * data, it is safe to pass a NULL pointer to this function to ignore it.
* *
* \param puserdata pointer which is filled with the "userdata" pointer that * \param puserdata pointer which is filled with the "userdata" pointer that
* was passed to SDL_SetAssertionHandler(). * was passed to SDL_SetAssertionHandler()
* \returns the SDL_AssertionHandler that is called when an assert triggers. * \returns the SDL_AssertionHandler that is called when an assert triggers.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,29 +20,38 @@
*/ */
/** /**
* # CategoryAtomic * \file SDL_atomic.h
* *
* Atomic operations. * Atomic operations.
* *
* IMPORTANT: If you are not an expert in concurrent lockless programming, you * IMPORTANT:
* should not be using any functions in this file. You should be protecting * If you are not an expert in concurrent lockless programming, you should
* your data structures with full mutexes instead. * only be using the atomic lock and reference counting functions in this
* file. In all other cases you should be protecting your data structures
* with full mutexes.
* *
* ***Seriously, here be dragons!*** * The list of "safe" functions to use are:
* SDL_AtomicLock()
* SDL_AtomicUnlock()
* SDL_AtomicIncRef()
* SDL_AtomicDecRef()
* *
* You can find out a little more about lockless programming and the subtle * Seriously, here be dragons!
* issues that can arise here: * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming *
* You can find out a little more about lockless programming and the
* subtle issues that can arise here:
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
* *
* There's also lots of good information here: * There's also lots of good information here:
* http://www.1024cores.net/home/lock-free-algorithms
* http://preshing.com/
* *
* - https://www.1024cores.net/home/lock-free-algorithms * These operations may or may not actually be implemented using
* - https://preshing.com/ * processor specific atomic operations. When possible they are
* * implemented as true processor specific atomic operations. When that
* These operations may or may not actually be implemented using processor * is not possible the are implemented using locks that *do* use the
* specific atomic operations. When possible they are implemented as true * available atomic operations.
* processor specific atomic operations. When that is not possible the are
* implemented using locks that *do* use the available atomic operations.
* *
* All of the atomic operations that modify memory are full memory barriers. * All of the atomic operations that modify memory are full memory barriers.
*/ */
@@ -85,7 +94,7 @@ typedef int SDL_SpinLock;
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already * \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
* held. * held.
* *
@@ -102,7 +111,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -119,7 +128,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -248,13 +257,10 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
/** /**
* A type representing an atomic integer value. * \brief A type representing an atomic integer value. It is a struct
* * so people don't accidentally use numeric operations on it.
* It is a struct so people don't accidentally use numeric operations on it.
*/ */
typedef struct SDL_atomic_t { typedef struct { int value; } SDL_atomic_t;
int value;
} SDL_atomic_t;
/** /**
* Set an atomic variable to a new value if it is currently an old value. * Set an atomic variable to a new value if it is currently an old value.
@@ -262,9 +268,9 @@ typedef struct SDL_atomic_t {
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param oldval the old value. * \param oldval the old value
* \param newval the new value. * \param newval the new value
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. * \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -283,8 +289,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param v the desired value. * \param v the desired value
* \returns the previous value of the atomic variable. * \returns the previous value of the atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -299,7 +305,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable. * \param a a pointer to an SDL_atomic_t variable
* \returns the current value of an atomic variable. * \returns the current value of an atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -316,8 +322,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param v the desired value to add. * \param v the desired value to add
* \returns the previous value of the atomic variable. * \returns the previous value of the atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -350,9 +356,9 @@ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \param oldval the old pointer value. * \param oldval the old pointer value
* \param newval the new pointer value. * \param newval the new pointer value
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise. * \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -369,8 +375,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \param v the desired pointer value. * \param v the desired pointer value
* \returns the previous value of the pointer. * \returns the previous value of the pointer.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -386,7 +392,7 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \returns the current value of a pointer. * \returns the current value of a pointer.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -22,7 +22,7 @@
/* !!! FIXME: several functions in here need Doxygen comments. */ /* !!! FIXME: several functions in here need Doxygen comments. */
/** /**
* # CategoryAudio * \file SDL_audio.h
* *
* Access to the raw audio mixing buffer for the SDL library. * Access to the raw audio mixing buffer for the SDL library.
*/ */
@@ -44,22 +44,22 @@ extern "C" {
#endif #endif
/** /**
* Audio format flags. * \brief Audio format flags.
* *
* These are what the 16 bits in SDL_AudioFormat currently mean... * These are what the 16 bits in SDL_AudioFormat currently mean...
* (Unspecified bits are always zero). * (Unspecified bits are always zero).
* *
* ``` * \verbatim
* ++-----------------------sample is signed if set ++-----------------------sample is signed if set
* || ||
* || ++-----------sample is bigendian if set || ++-----------sample is bigendian if set
* || || || ||
* || || ++---sample is float if set || || ++---sample is float if set
* || || || || || ||
* || || || +---sample bit size---+ || || || +---sample bit size---+
* || || || | | || || || | |
* 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
* ``` \endverbatim
* *
* There are macros in SDL 2.0 and later to query these bits. * There are macros in SDL 2.0 and later to query these bits.
*/ */
@@ -151,10 +151,16 @@ typedef Uint16 SDL_AudioFormat;
/** /**
* This function is called when the audio device needs more data. * This function is called when the audio device needs more data.
* *
* \param userdata An application-specific parameter saved in the * \param userdata An application-specific parameter saved in
* SDL_AudioSpec structure. * the SDL_AudioSpec structure
* \param stream A pointer to the audio data buffer. * \param stream A pointer to the audio data buffer.
* \param len Length of **stream** in bytes. * \param len The length of that buffer in bytes.
*
* Once the callback returns, the buffer will no longer be valid.
* Stereo samples are stored in a LRLRLR ordering.
*
* You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
* you like. Just open your audio device with a NULL callback.
*/ */
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
int len); int len);
@@ -163,8 +169,6 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
* The calculated values in this structure are calculated by SDL_OpenAudio(). * The calculated values in this structure are calculated by SDL_OpenAudio().
* *
* For multi-channel audio, the default SDL channel mapping is: * For multi-channel audio, the default SDL channel mapping is:
*
* ```
* 2: FL FR (stereo) * 2: FL FR (stereo)
* 3: FL FR LFE (2.1 surround) * 3: FL FR LFE (2.1 surround)
* 4: FL FR BL BR (quad) * 4: FL FR BL BR (quad)
@@ -172,7 +176,6 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
* 7: FL FR FC LFE BC SL SR (6.1 surround) * 7: FL FR FC LFE BC SL SR (6.1 surround)
* 8: FL FR FC LFE BL BR SL SR (7.1 surround) * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
* ```
*/ */
typedef struct SDL_AudioSpec typedef struct SDL_AudioSpec
{ {
@@ -193,11 +196,11 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
SDL_AudioFormat format); SDL_AudioFormat format);
/** /**
* Upper limit of filters in SDL_AudioCVT * \brief Upper limit of filters in SDL_AudioCVT
* *
* The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
* currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, one * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
* of which is the terminating NULL pointer. * one of which is the terminating NULL pointer.
*/ */
#define SDL_AUDIOCVT_MAX_FILTERS 9 #define SDL_AUDIOCVT_MAX_FILTERS 9
@@ -284,7 +287,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
* meant to be proper names. * meant to be proper names.
* *
* \param index the index of the audio driver; the value ranges from 0 to * \param index the index of the audio driver; the value ranges from 0 to
* SDL_GetNumAudioDrivers() - 1. * SDL_GetNumAudioDrivers() - 1
* \returns the name of the audio driver at the requested index, or NULL if an * \returns the name of the audio driver at the requested index, or NULL if an
* invalid index was specified. * invalid index was specified.
* *
@@ -311,7 +314,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
* specific need to designate the audio driver you want to use. You should * specific need to designate the audio driver you want to use. You should
* normally use SDL_Init() or SDL_InitSubSystem(). * normally use SDL_Init() or SDL_InitSubSystem().
* *
* \param driver_name the name of the desired audio driver. * \param driver_name the name of the desired audio driver
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -407,11 +410,11 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
/** /**
* SDL Audio Device IDs. * SDL Audio Device IDs.
* *
* A successful call to SDL_OpenAudio() is always device id 1, and legacy SDL * A successful call to SDL_OpenAudio() is always device id 1, and legacy
* audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
* always returns devices >= 2 on success. The legacy calls are good both for * always returns devices >= 2 on success. The legacy calls are good both
* backwards compatibility and when you don't care about multiple, specific, * for backwards compatibility and when you don't care about multiple,
* or capture devices. * specific, or capture devices.
*/ */
typedef Uint32 SDL_AudioDeviceID; typedef Uint32 SDL_AudioDeviceID;
@@ -449,7 +452,7 @@ typedef Uint32 SDL_AudioDeviceID;
* ``` * ```
* *
* \param iscapture zero to request playback devices, non-zero to request * \param iscapture zero to request playback devices, non-zero to request
* recording devices. * recording devices
* \returns the number of available devices exposed by the current driver or * \returns the number of available devices exposed by the current driver or
* -1 if an explicit list of devices can't be determined. A return * -1 if an explicit list of devices can't be determined. A return
* value of -1 does not necessarily mean an error condition. * value of -1 does not necessarily mean an error condition.
@@ -475,7 +478,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
* invalid next time any of several other SDL functions are called. * invalid next time any of several other SDL functions are called.
* *
* \param index the index of the audio device; valid values range from 0 to * \param index the index of the audio device; valid values range from 0 to
* SDL_GetNumAudioDevices() - 1. * SDL_GetNumAudioDevices() - 1
* \param iscapture non-zero to query the list of recording devices, zero to * \param iscapture non-zero to query the list of recording devices, zero to
* query the list of output devices. * query the list of output devices.
* \returns the name of the audio device at the requested index, or NULL on * \returns the name of the audio device at the requested index, or NULL on
@@ -501,11 +504,11 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
* count. * count.
* *
* \param index the index of the audio device; valid values range from 0 to * \param index the index of the audio device; valid values range from 0 to
* SDL_GetNumAudioDevices() - 1. * SDL_GetNumAudioDevices() - 1
* \param iscapture non-zero to query the list of recording devices, zero to * \param iscapture non-zero to query the list of recording devices, zero to
* query the list of output devices. * query the list of output devices.
* \param spec The SDL_AudioSpec to be initialized by this function. * \param spec The SDL_AudioSpec to be initialized by this function.
* \returns 0 on success, nonzero on error. * \returns 0 on success, nonzero on error
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
* *
@@ -539,7 +542,7 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
* \param spec The SDL_AudioSpec to be initialized by this function. * \param spec The SDL_AudioSpec to be initialized by this function.
* \param iscapture non-zero to query the default recording device, zero to * \param iscapture non-zero to query the default recording device, zero to
* query the default output device. * query the default output device.
* \returns 0 on success, nonzero on error. * \returns 0 on success, nonzero on error
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *
@@ -642,13 +645,13 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
* driver-specific name as appropriate. NULL requests the most * driver-specific name as appropriate. NULL requests the most
* reasonable default device. * reasonable default device.
* \param iscapture non-zero to specify a device should be opened for * \param iscapture non-zero to specify a device should be opened for
* recording, not playback. * recording, not playback
* \param desired an SDL_AudioSpec structure representing the desired output * \param desired an SDL_AudioSpec structure representing the desired output
* format; see SDL_OpenAudio() for more information. * format; see SDL_OpenAudio() for more information
* \param obtained an SDL_AudioSpec structure filled in with the actual output * \param obtained an SDL_AudioSpec structure filled in with the actual output
* format; see SDL_OpenAudio() for more information. * format; see SDL_OpenAudio() for more information
* \param allowed_changes 0, or one or more flags OR'd together. * \param allowed_changes 0, or one or more flags OR'd together
* \returns a valid device ID > 0 on success or 0 on failure; call * \returns a valid device ID that is > 0 on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
* For compatibility with SDL 1.2, this will never return 1, since * For compatibility with SDL 1.2, this will never return 1, since
@@ -709,7 +712,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
* Use this function to get the current audio state of an audio device. * Use this function to get the current audio state of an audio device.
* *
* \param dev the ID of an audio device previously opened with * \param dev the ID of an audio device previously opened with
* SDL_OpenAudioDevice(). * SDL_OpenAudioDevice()
* \returns the SDL_AudioStatus of the specified audio device. * \returns the SDL_AudioStatus of the specified audio device.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -742,7 +745,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDevice
* *
* ...and is only useful if you used the legacy SDL_OpenAudio() function. * ...and is only useful if you used the legacy SDL_OpenAudio() function.
* *
* \param pause_on non-zero to pause, 0 to unpause. * \param pause_on non-zero to pause, 0 to unpause
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -772,8 +775,8 @@ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
* callback, you shouldn't pause the audio device, as it will lead to dropouts * callback, you shouldn't pause the audio device, as it will lead to dropouts
* in the audio playback. Instead, you should use SDL_LockAudioDevice(). * in the audio playback. Instead, you should use SDL_LockAudioDevice().
* *
* \param dev a device opened by SDL_OpenAudioDevice(). * \param dev a device opened by SDL_OpenAudioDevice()
* \param pause_on non-zero to pause, 0 to unpause. * \param pause_on non-zero to pause, 0 to unpause
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -838,14 +841,14 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
* SDL_LoadWAV("sample.wav", &spec, &buf, &len); * SDL_LoadWAV("sample.wav", &spec, &buf, &len);
* ``` * ```
* *
* \param src The data source for the WAVE data. * \param src The data source for the WAVE data
* \param freesrc If non-zero, SDL will _always_ free the data source. * \param freesrc If non-zero, SDL will _always_ free the data source
* \param spec An SDL_AudioSpec that will be filled in with the wave file's * \param spec An SDL_AudioSpec that will be filled in with the wave file's
* format details. * format details
* \param audio_buf A pointer filled with the audio data, allocated by the * \param audio_buf A pointer filled with the audio data, allocated by the
* function. * function.
* \param audio_len A pointer filled with the length of the audio data buffer * \param audio_len A pointer filled with the length of the audio data buffer
* in bytes. * in bytes
* \returns This function, if successfully called, returns `spec`, which will * \returns This function, if successfully called, returns `spec`, which will
* be filled with the audio data format of the wave source data. * be filled with the audio data format of the wave source data.
* `audio_buf` will be filled with a pointer to an allocated buffer * `audio_buf` will be filled with a pointer to an allocated buffer
@@ -872,7 +875,6 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
/** /**
* Loads a WAV from a file. * Loads a WAV from a file.
*
* Compatibility convenience function. * Compatibility convenience function.
*/ */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
@@ -886,7 +888,7 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
* this function with a NULL pointer. * this function with a NULL pointer.
* *
* \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or
* SDL_LoadWAV_RW(). * SDL_LoadWAV_RW()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -910,16 +912,15 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
* and then can call SDL_ConvertAudio() to complete the conversion. * and then can call SDL_ConvertAudio() to complete the conversion.
* *
* \param cvt an SDL_AudioCVT structure filled in with audio conversion * \param cvt an SDL_AudioCVT structure filled in with audio conversion
* information. * information
* \param src_format the source format of the audio data; for more info see * \param src_format the source format of the audio data; for more info see
* SDL_AudioFormat. * SDL_AudioFormat
* \param src_channels the number of channels in the source. * \param src_channels the number of channels in the source
* \param src_rate the frequency (sample-frames-per-second) of the source. * \param src_rate the frequency (sample-frames-per-second) of the source
* \param dst_format the destination format of the audio data; for more info * \param dst_format the destination format of the audio data; for more info
* see SDL_AudioFormat. * see SDL_AudioFormat
* \param dst_channels the number of channels in the destination. * \param dst_channels the number of channels in the destination
* \param dst_rate the frequency (sample-frames-per-second) of the * \param dst_rate the frequency (sample-frames-per-second) of the destination
* destination.
* \returns 1 if the audio filter is prepared, 0 if no conversion is needed, * \returns 1 if the audio filter is prepared, 0 if no conversion is needed,
* or a negative error code on failure; call SDL_GetError() for more * or a negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -990,12 +991,12 @@ typedef struct _SDL_AudioStream SDL_AudioStream;
/** /**
* Create a new audio stream. * Create a new audio stream.
* *
* \param src_format The format of the source audio. * \param src_format The format of the source audio
* \param src_channels The number of channels of the source audio. * \param src_channels The number of channels of the source audio
* \param src_rate The sampling rate of the source audio. * \param src_rate The sampling rate of the source audio
* \param dst_format The format of the desired audio output. * \param dst_format The format of the desired audio output
* \param dst_channels The number of channels of the desired audio output. * \param dst_channels The number of channels of the desired audio output
* \param dst_rate The sampling rate of the desired audio output. * \param dst_rate The sampling rate of the desired audio output
* \returns 0 on success, or -1 on error. * \returns 0 on success, or -1 on error.
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
@@ -1017,9 +1018,9 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm
/** /**
* Add data to be converted/resampled to the stream. * Add data to be converted/resampled to the stream.
* *
* \param stream The stream the audio data is being added to. * \param stream The stream the audio data is being added to
* \param buf A pointer to the audio data to add. * \param buf A pointer to the audio data to add
* \param len The number of bytes to write to the stream. * \param len The number of bytes to write to the stream
* \returns 0 on success, or -1 on error. * \returns 0 on success, or -1 on error.
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
@@ -1036,10 +1037,10 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const vo
/** /**
* Get converted/resampled data from the stream * Get converted/resampled data from the stream
* *
* \param stream The stream the audio is being requested from. * \param stream The stream the audio is being requested from
* \param buf A buffer to fill with audio data. * \param buf A buffer to fill with audio data
* \param len The maximum number of bytes to fill. * \param len The maximum number of bytes to fill
* \returns the number of bytes read from the stream, or -1 on error. * \returns the number of bytes read from the stream, or -1 on error
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
* *
@@ -1117,9 +1118,6 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
*/ */
extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
/**
* Maximum volume allowed in calls to SDL_MixAudio and SDL_MixAudioFormat.
*/
#define SDL_MIX_MAXVOLUME 128 #define SDL_MIX_MAXVOLUME 128
/** /**
@@ -1134,11 +1132,11 @@ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
* ...where `format` is the obtained format of the audio device from the * ...where `format` is the obtained format of the audio device from the
* legacy SDL_OpenAudio() function. * legacy SDL_OpenAudio() function.
* *
* \param dst the destination for the mixed audio. * \param dst the destination for the mixed audio
* \param src the source audio buffer to be mixed. * \param src the source audio buffer to be mixed
* \param len the length of the audio buffer in bytes. * \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume. * for full audio volume
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1167,13 +1165,13 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
* SDL_MixAudioFormat() is really only needed when you're mixing a single * SDL_MixAudioFormat() is really only needed when you're mixing a single
* audio stream with a volume adjustment. * audio stream with a volume adjustment.
* *
* \param dst the destination for the mixed audio. * \param dst the destination for the mixed audio
* \param src the source audio buffer to be mixed. * \param src the source audio buffer to be mixed
* \param format the SDL_AudioFormat structure representing the desired audio * \param format the SDL_AudioFormat structure representing the desired audio
* format. * format
* \param len the length of the audio buffer in bytes. * \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume. * for full audio volume
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
@@ -1217,9 +1215,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
* from planar audio formats into a non-planar one (see SDL_AudioFormat) * from planar audio formats into a non-planar one (see SDL_AudioFormat)
* before queuing audio. * before queuing audio.
* *
* \param dev the device ID to which we will queue audio. * \param dev the device ID to which we will queue audio
* \param data the data to queue to the device for later playback. * \param data the data to queue to the device for later playback
* \param len the number of bytes (not samples!) to which `data` points. * \param len the number of bytes (not samples!) to which `data` points
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1265,9 +1263,9 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da
* You should not call SDL_LockAudio() on the device before dequeueing; SDL * You should not call SDL_LockAudio() on the device before dequeueing; SDL
* handles locking internally for this function. * handles locking internally for this function.
* *
* \param dev the device ID from which we will dequeue audio. * \param dev the device ID from which we will dequeue audio
* \param data a pointer into where audio data should be copied. * \param data a pointer into where audio data should be copied
* \param len the number of bytes (not samples!) to which (data) points. * \param len the number of bytes (not samples!) to which (data) points
* \returns the number of bytes dequeued, which could be less than requested; * \returns the number of bytes dequeued, which could be less than requested;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -1301,7 +1299,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *dat
* You should not call SDL_LockAudio() on the device before querying; SDL * You should not call SDL_LockAudio() on the device before querying; SDL
* handles locking internally for this function. * handles locking internally for this function.
* *
* \param dev the device ID of which we will query queued audio size. * \param dev the device ID of which we will query queued audio size
* \returns the number of bytes (not samples!) of queued audio. * \returns the number of bytes (not samples!) of queued audio.
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
@@ -1336,7 +1334,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
* *
* This function always succeeds and thus returns void. * This function always succeeds and thus returns void.
* *
* \param dev the device ID of which to clear the audio queue. * \param dev the device ID of which to clear the audio queue
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
* *
@@ -1408,7 +1406,7 @@ extern DECLSPEC void SDLCALL SDL_LockAudio(void);
* at once, not only will you block the audio callback, you'll block the other * at once, not only will you block the audio callback, you'll block the other
* thread. * thread.
* *
* \param dev the ID of the device to be locked. * \param dev the ID of the device to be locked
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1441,7 +1439,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
* *
* This function should be paired with a previous SDL_LockAudioDevice() call. * This function should be paired with a previous SDL_LockAudioDevice() call.
* *
* \param dev the ID of the device to be unlocked. * \param dev the ID of the device to be unlocked
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1483,7 +1481,7 @@ extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
* The device ID is invalid as soon as the device is closed, and is eligible * The device ID is invalid as soon as the device is closed, and is eligible
* for reuse in a new SDL_OpenAudioDevice() call immediately. * for reuse in a new SDL_OpenAudioDevice() call immediately.
* *
* \param dev an audio device previously opened with SDL_OpenAudioDevice(). * \param dev an audio device previously opened with SDL_OpenAudioDevice()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryBits * \file SDL_bits.h
* *
* Functions for fiddling with bits and bitmasks. * Functions for fiddling with bits and bitmasks.
*/ */
@@ -56,12 +56,6 @@ extern __inline int _SDL_bsr_watcom(Uint32);
modify exact [eax] nomemory; modify exact [eax] nomemory;
#endif #endif
/**
* Use this function to get the index of the most significant (set) bit in a
*
* \param x the number to find the MSB of.
* \returns the index of the most significant bit of x, or -1 if x is 0.
*/
SDL_FORCE_INLINE int SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x) SDL_MostSignificantBitIndex32(Uint32 x)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryBlendmode * \file SDL_blendmode.h
* *
* Header file declaring the SDL_BlendMode enumeration * Header file declaring the SDL_BlendMode enumeration
*/ */
@@ -35,9 +35,9 @@ extern "C" {
#endif #endif
/** /**
* The blend mode used in SDL_RenderCopy() and drawing operations. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
*/ */
typedef enum SDL_BlendMode typedef enum
{ {
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
dstRGBA = srcRGBA */ dstRGBA = srcRGBA */
@@ -60,10 +60,9 @@ typedef enum SDL_BlendMode
} SDL_BlendMode; } SDL_BlendMode;
/** /**
* The blend operation used when combining source and destination pixel * \brief The blend operation used when combining source and destination pixel components
* components
*/ */
typedef enum SDL_BlendOperation typedef enum
{ {
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
@@ -73,9 +72,9 @@ typedef enum SDL_BlendOperation
} SDL_BlendOperation; } SDL_BlendOperation;
/** /**
* The normalized factor used to multiply pixel components * \brief The normalized factor used to multiply pixel components
*/ */
typedef enum SDL_BlendFactor typedef enum
{ {
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
@@ -159,18 +158,18 @@ typedef enum SDL_BlendFactor
* case. * case.
* *
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and * \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the source pixels. * blue components of the source pixels
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and * \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the destination pixels. * blue components of the destination pixels
* \param colorOperation the SDL_BlendOperation used to combine the red, * \param colorOperation the SDL_BlendOperation used to combine the red,
* green, and blue components of the source and * green, and blue components of the source and
* destination pixels. * destination pixels
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of * \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the source pixels. * the source pixels
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of * \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the destination pixels. * the destination pixels
* \param alphaOperation the SDL_BlendOperation used to combine the alpha * \param alphaOperation the SDL_BlendOperation used to combine the alpha
* component of the source and destination pixels. * component of the source and destination pixels
* \returns an SDL_BlendMode that represents the chosen factors and * \returns an SDL_BlendMode that represents the chosen factors and
* operations. * operations.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryClipboard * \file SDL_clipboard.h
* *
* Include file for SDL clipboard handling * Include file for SDL clipboard handling
*/ */
@@ -41,7 +41,7 @@ extern "C" {
/** /**
* Put UTF-8 text into the clipboard. * Put UTF-8 text into the clipboard.
* *
* \param text the text to store in the clipboard. * \param text the text to store in the clipboard
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -85,7 +85,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/** /**
* Put UTF-8 text into the primary selection. * Put UTF-8 text into the primary selection.
* *
* \param text the text to store in the primary selection. * \param text the text to store in the primary selection
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -24,7 +24,9 @@
#include "SDL_platform.h" #include "SDL_platform.h"
/* WIKI CATEGORY: - */ /**
* \file SDL_config.h
*/
/* Add any platform that doesn't build using the configure system. */ /* Add any platform that doesn't build using the configure system. */
#if defined(__WIN32__) #if defined(__WIN32__)

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -193,7 +193,6 @@
#cmakedefine HAVE_MEMFD_CREATE 1 #cmakedefine HAVE_MEMFD_CREATE 1
#cmakedefine HAVE_POSIX_FALLOCATE 1 #cmakedefine HAVE_POSIX_FALLOCATE 1
#cmakedefine HAVE_SIGACTION 1 #cmakedefine HAVE_SIGACTION 1
#cmakedefine HAVE_SIGTIMEDWAIT 1
#cmakedefine HAVE_SA_SIGACTION 1 #cmakedefine HAVE_SA_SIGACTION 1
#cmakedefine HAVE_SETJMP 1 #cmakedefine HAVE_SETJMP 1
#cmakedefine HAVE_NANOSLEEP 1 #cmakedefine HAVE_NANOSLEEP 1

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -195,7 +195,6 @@
#undef HAVE_FSEEKO #undef HAVE_FSEEKO
#undef HAVE_FSEEKO64 #undef HAVE_FSEEKO64
#undef HAVE_SIGACTION #undef HAVE_SIGACTION
#undef HAVE_SIGTIMEDWAIT
#undef HAVE_SA_SIGACTION #undef HAVE_SA_SIGACTION
#undef HAVE_SETJMP #undef HAVE_SETJMP
#undef HAVE_NANOSLEEP #undef HAVE_NANOSLEEP
@@ -217,7 +216,6 @@
#undef HAVE__EXIT #undef HAVE__EXIT
#else #else
#define HAVE_STDARG_H 1 #define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1 #define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1 #define HAVE_STDINT_H 1

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,16 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: CPUInfo */
/** /**
* # CategoryCPUInfo * \file SDL_cpuinfo.h
* *
* CPU feature detection for SDL. * CPU feature detection for SDL.
*
* These functions are largely concerned with reporting if the system has
* access to various SIMD instruction sets, but also has other important info
* to share, such as number of logical CPU cores.
*/ */
#ifndef SDL_cpuinfo_h_ #ifndef SDL_cpuinfo_h_
@@ -115,8 +109,7 @@ _m_prefetch(void *__P)
#include <lasxintrin.h> #include <lasxintrin.h>
#define __LASX__ #define __LASX__
#endif #endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) && \ #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
(defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86))
#include <immintrin.h> #include <immintrin.h>
#else #else
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_egl.h
*
* This is a simple file to encapsulate the EGL API headers. * This is a simple file to encapsulate the EGL API headers.
*/ */
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) #if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(__vita__) || defined(__psp2__) #if defined(__vita__) || defined(__psp2__)

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryEndian * \file SDL_endian.h
* *
* Functions for reading and writing endian-specific values * Functions for reading and writing endian-specific values
*/ */
@@ -59,15 +59,6 @@ _m_prefetch(void *__P)
#ifdef __linux__ #ifdef __linux__
#include <endian.h> #include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER #define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__sun) && defined(__SVR4) /* Solaris */
#include <sys/byteorder.h>
#if defined(_LITTLE_ENDIAN)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif defined(_BIG_ENDIAN)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif
#elif defined(__OpenBSD__) || defined(__DragonFly__) #elif defined(__OpenBSD__) || defined(__DragonFly__)
#include <endian.h> #include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER #define SDL_BYTEORDER BYTE_ORDER
@@ -88,7 +79,7 @@ _m_prefetch(void *__P)
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \ (defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \ defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
defined(__sparc__) || defined(__sparc) defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN #define SDL_BYTEORDER SDL_BIG_ENDIAN
#else #else
#define SDL_BYTEORDER SDL_LIL_ENDIAN #define SDL_BYTEORDER SDL_LIL_ENDIAN
@@ -189,16 +180,6 @@ extern __inline Uint16 SDL_Swap16(Uint16);
parm [ax] \ parm [ax] \
modify [ax]; modify [ax];
#else #else
/**
* Use this function to swap the byte order of a 16-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE16
* \sa SDL_SwapLE16
*/
SDL_FORCE_INLINE Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
@@ -250,16 +231,6 @@ extern __inline Uint32 SDL_Swap32(Uint32);
parm [eax] \ parm [eax] \
modify [eax]; modify [eax];
#else #else
/**
* Use this function to swap the byte order of a 32-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE32
* \sa SDL_SwapLE32
*/
SDL_FORCE_INLINE Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
@@ -305,16 +276,6 @@ extern __inline Uint64 SDL_Swap64(Uint64);
parm [eax edx] \ parm [eax edx] \
modify [eax edx]; modify [eax edx];
#else #else
/**
* Use this function to swap the byte order of a 64-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE64
* \sa SDL_SwapLE64
*/
SDL_FORCE_INLINE Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
{ {
@@ -332,15 +293,6 @@ SDL_Swap64(Uint64 x)
#endif #endif
/**
* Use this function to swap the byte order of a floating point value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapFloatBE
* \sa SDL_SwapFloatLE
*/
SDL_FORCE_INLINE float SDL_FORCE_INLINE float
SDL_SwapFloat(float x) SDL_SwapFloat(float x)
{ {

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryError * \file SDL_error.h
* *
* Simple error message routines for SDL. * Simple error message routines for SDL.
*/ */
@@ -53,9 +53,9 @@ extern "C" {
* } * }
* ``` * ```
* *
* \param fmt a printf()-style message format string. * \param fmt a printf()-style message format string
* \param ... additional parameters matching % tokens in the `fmt` string, if * \param ... additional parameters matching % tokens in the `fmt` string, if
* any. * any
* \returns always -1. * \returns always -1.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -109,8 +109,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
* otherwise operates exactly the same as SDL_GetError(). * otherwise operates exactly the same as SDL_GetError().
* *
* \param errstr A buffer to fill with the last error message that was set for * \param errstr A buffer to fill with the last error message that was set for
* the current thread. * the current thread
* \param maxlen The size of the buffer pointed to by the errstr parameter. * \param maxlen The size of the buffer pointed to by the errstr parameter
* \returns the pointer passed in as the `errstr` parameter. * \returns the pointer passed in as the `errstr` parameter.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryEvents * \file SDL_events.h
* *
* Include file for SDL event handling. * Include file for SDL event handling.
*/ */
@@ -52,7 +52,7 @@ extern "C" {
/** /**
* The types of events that can be delivered. * The types of events that can be delivered.
*/ */
typedef enum SDL_EventType typedef enum
{ {
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
@@ -167,7 +167,7 @@ typedef enum SDL_EventType
/* Internal events */ /* Internal events */
SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */ SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
/** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents() * and should be allocated with SDL_RegisterEvents()
*/ */
SDL_USEREVENT = 0x8000, SDL_USEREVENT = 0x8000,
@@ -179,7 +179,7 @@ typedef enum SDL_EventType
} SDL_EventType; } SDL_EventType;
/** /**
* Fields shared by every event * \brief Fields shared by every event
*/ */
typedef struct SDL_CommonEvent typedef struct SDL_CommonEvent
{ {
@@ -188,14 +188,14 @@ typedef struct SDL_CommonEvent
} SDL_CommonEvent; } SDL_CommonEvent;
/** /**
* Display state change event data (event.display.*) * \brief Display state change event data (event.display.*)
*/ */
typedef struct SDL_DisplayEvent typedef struct SDL_DisplayEvent
{ {
Uint32 type; /**< SDL_DISPLAYEVENT */ Uint32 type; /**< ::SDL_DISPLAYEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 display; /**< The associated display index */ Uint32 display; /**< The associated display index */
Uint8 event; /**< SDL_DisplayEventID */ Uint8 event; /**< ::SDL_DisplayEventID */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -203,14 +203,14 @@ typedef struct SDL_DisplayEvent
} SDL_DisplayEvent; } SDL_DisplayEvent;
/** /**
* Window state change event data (event.window.*) * \brief Window state change event data (event.window.*)
*/ */
typedef struct SDL_WindowEvent typedef struct SDL_WindowEvent
{ {
Uint32 type; /**< SDL_WINDOWEVENT */ Uint32 type; /**< ::SDL_WINDOWEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window */ Uint32 windowID; /**< The associated window */
Uint8 event; /**< SDL_WindowEventID */ Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -219,14 +219,14 @@ typedef struct SDL_WindowEvent
} SDL_WindowEvent; } SDL_WindowEvent;
/** /**
* Keyboard button event structure (event.key.*) * \brief Keyboard button event structure (event.key.*)
*/ */
typedef struct SDL_KeyboardEvent typedef struct SDL_KeyboardEvent
{ {
Uint32 type; /**< SDL_KEYDOWN or SDL_KEYUP */ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 repeat; /**< Non-zero if this is a key repeat */ Uint8 repeat; /**< Non-zero if this is a key repeat */
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -234,13 +234,12 @@ typedef struct SDL_KeyboardEvent
} SDL_KeyboardEvent; } SDL_KeyboardEvent;
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
/** /**
* Keyboard text editing event structure (event.edit.*) * \brief Keyboard text editing event structure (event.edit.*)
*/ */
typedef struct SDL_TextEditingEvent typedef struct SDL_TextEditingEvent
{ {
Uint32 type; /**< SDL_TEXTEDITING */ Uint32 type; /**< ::SDL_TEXTEDITING */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
@@ -249,12 +248,12 @@ typedef struct SDL_TextEditingEvent
} SDL_TextEditingEvent; } SDL_TextEditingEvent;
/** /**
* Extended keyboard text editing event structure (event.editExt.*) when text * \brief Extended keyboard text editing event structure (event.editExt.*) when text would be
* would be truncated if stored in the text buffer SDL_TextEditingEvent * truncated if stored in the text buffer SDL_TextEditingEvent
*/ */
typedef struct SDL_TextEditingExtEvent typedef struct SDL_TextEditingExtEvent
{ {
Uint32 type; /**< SDL_TEXTEDITING_EXT */ Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */ char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
@@ -262,43 +261,24 @@ typedef struct SDL_TextEditingExtEvent
Sint32 length; /**< The length of selected editing text */ Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingExtEvent; } SDL_TextEditingExtEvent;
/**
* The maximum bytes of text that can be supplied in an SDL_TextInputEvent.
*/
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
/** /**
* Keyboard text input event structure (event.text.*) * \brief Keyboard text input event structure (event.text.*)
*
* `text` is limited to SDL_TEXTINPUTEVENT_TEXT_SIZE bytes. If the incoming
* string is larger than this, SDL will split it and send it in pieces, across
* multiple events. The string is in UTF-8 format, and if split, SDL
* guarantees that it will not split in the middle of a UTF-8 sequence, so any
* event will only contain complete codepoints. However, if there are several
* codepoints that go together into a single glyph (like an emoji "thumbs up"
* followed by a skin color), they may be split between events.
*
* This event will never be delivered unless text input is enabled by calling
* SDL_StartTextInput(). Text input is enabled by default on desktop
* platforms, and disabled by default on mobile platforms!
*
* \sa SDL_StartTextInput
* \sa SDL_StopTextInput
*/ */
typedef struct SDL_TextInputEvent typedef struct SDL_TextInputEvent
{ {
Uint32 type; /**< SDL_TEXTINPUT */ Uint32 type; /**< ::SDL_TEXTINPUT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text; UTF-8 encoded. */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent; } SDL_TextInputEvent;
/** /**
* Mouse motion event structure (event.motion.*) * \brief Mouse motion event structure (event.motion.*)
*/ */
typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseMotionEvent
{ {
Uint32 type; /**< SDL_MOUSEMOTION */ Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -310,16 +290,16 @@ typedef struct SDL_MouseMotionEvent
} SDL_MouseMotionEvent; } SDL_MouseMotionEvent;
/** /**
* Mouse button event structure (event.button.*) * \brief Mouse button event structure (event.button.*)
*/ */
typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseButtonEvent
{ {
Uint32 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */ Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
Uint8 padding1; Uint8 padding1;
Sint32 x; /**< X coordinate, relative to window */ Sint32 x; /**< X coordinate, relative to window */
@@ -327,11 +307,11 @@ typedef struct SDL_MouseButtonEvent
} SDL_MouseButtonEvent; } SDL_MouseButtonEvent;
/** /**
* Mouse wheel event structure (event.wheel.*) * \brief Mouse wheel event structure (event.wheel.*)
*/ */
typedef struct SDL_MouseWheelEvent typedef struct SDL_MouseWheelEvent
{ {
Uint32 type; /**< SDL_MOUSEWHEEL */ Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -345,11 +325,11 @@ typedef struct SDL_MouseWheelEvent
} SDL_MouseWheelEvent; } SDL_MouseWheelEvent;
/** /**
* Joystick axis motion event structure (event.jaxis.*) * \brief Joystick axis motion event structure (event.jaxis.*)
*/ */
typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyAxisEvent
{ {
Uint32 type; /**< SDL_JOYAXISMOTION */ Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */ Uint8 axis; /**< The joystick axis index */
@@ -361,11 +341,11 @@ typedef struct SDL_JoyAxisEvent
} SDL_JoyAxisEvent; } SDL_JoyAxisEvent;
/** /**
* Joystick trackball motion event structure (event.jball.*) * \brief Joystick trackball motion event structure (event.jball.*)
*/ */
typedef struct SDL_JoyBallEvent typedef struct SDL_JoyBallEvent
{ {
Uint32 type; /**< SDL_JOYBALLMOTION */ Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */ Uint8 ball; /**< The joystick trackball index */
@@ -377,18 +357,18 @@ typedef struct SDL_JoyBallEvent
} SDL_JoyBallEvent; } SDL_JoyBallEvent;
/** /**
* Joystick hat position change event structure (event.jhat.*) * \brief Joystick hat position change event structure (event.jhat.*)
*/ */
typedef struct SDL_JoyHatEvent typedef struct SDL_JoyHatEvent
{ {
Uint32 type; /**< SDL_JOYHATMOTION */ Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */ Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value. Uint8 value; /**< The hat position value.
* \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
* \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
* \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
* *
* Note that zero means the POV is centered. * Note that zero means the POV is centered.
*/ */
@@ -397,51 +377,46 @@ typedef struct SDL_JoyHatEvent
} SDL_JoyHatEvent; } SDL_JoyHatEvent;
/** /**
* Joystick button event structure (event.jbutton.*) * \brief Joystick button event structure (event.jbutton.*)
*/ */
typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyButtonEvent
{ {
Uint32 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */ Uint8 button; /**< The joystick button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
} SDL_JoyButtonEvent; } SDL_JoyButtonEvent;
/** /**
* Joystick device event structure (event.jdevice.*) * \brief Joystick device event structure (event.jdevice.*)
*
* SDL will send JOYSTICK_ADDED events for devices that are already plugged in
* during SDL_Init.
*
* \sa SDL_ControllerDeviceEvent
*/ */
typedef struct SDL_JoyDeviceEvent typedef struct SDL_JoyDeviceEvent
{ {
Uint32 type; /**< SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED */ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent; } SDL_JoyDeviceEvent;
/** /**
* Joysick battery level change event structure (event.jbattery.*) * \brief Joysick battery level change event structure (event.jbattery.*)
*/ */
typedef struct SDL_JoyBatteryEvent typedef struct SDL_JoyBatteryEvent
{ {
Uint32 type; /**< SDL_JOYBATTERYUPDATED */ Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
SDL_JoystickPowerLevel level; /**< The joystick battery level */ SDL_JoystickPowerLevel level; /**< The joystick battery level */
} SDL_JoyBatteryEvent; } SDL_JoyBatteryEvent;
/** /**
* Game controller axis motion event structure (event.caxis.*) * \brief Game controller axis motion event structure (event.caxis.*)
*/ */
typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerAxisEvent
{ {
Uint32 type; /**< SDL_CONTROLLERAXISMOTION */ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
@@ -454,42 +429,36 @@ typedef struct SDL_ControllerAxisEvent
/** /**
* Game controller button event structure (event.cbutton.*) * \brief Game controller button event structure (event.cbutton.*)
*/ */
typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerButtonEvent
{ {
Uint32 type; /**< SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP */ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
} SDL_ControllerButtonEvent; } SDL_ControllerButtonEvent;
/** /**
* Controller device event structure (event.cdevice.*) * \brief Controller device event structure (event.cdevice.*)
*
* Joysticks that are supported game controllers receive both an
* SDL_JoyDeviceEvent and an SDL_ControllerDeviceEvent.
*
* SDL will send CONTROLLERDEVICEADDED events for joysticks that are already
* plugged in during SDL_Init() and are recognized as game controllers.
*/ */
typedef struct SDL_ControllerDeviceEvent typedef struct SDL_ControllerDeviceEvent
{ {
Uint32 type; /**< SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, or SDL_CONTROLLERSTEAMHANDLEUPDATED */ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, ::SDL_CONTROLLERDEVICEREMAPPED, or ::SDL_CONTROLLERSTEAMHANDLEUPDATED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent; } SDL_ControllerDeviceEvent;
/** /**
* Game controller touchpad event structure (event.ctouchpad.*) * \brief Game controller touchpad event structure (event.ctouchpad.*)
*/ */
typedef struct SDL_ControllerTouchpadEvent typedef struct SDL_ControllerTouchpadEvent
{ {
Uint32 type; /**< SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP */ Uint32 type; /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Sint32 touchpad; /**< The index of the touchpad */ Sint32 touchpad; /**< The index of the touchpad */
@@ -500,24 +469,24 @@ typedef struct SDL_ControllerTouchpadEvent
} SDL_ControllerTouchpadEvent; } SDL_ControllerTouchpadEvent;
/** /**
* Game controller sensor event structure (event.csensor.*) * \brief Game controller sensor event structure (event.csensor.*)
*/ */
typedef struct SDL_ControllerSensorEvent typedef struct SDL_ControllerSensorEvent
{ {
Uint32 type; /**< SDL_CONTROLLERSENSORUPDATE */ Uint32 type; /**< ::SDL_CONTROLLERSENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */ Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
} SDL_ControllerSensorEvent; } SDL_ControllerSensorEvent;
/** /**
* Audio device event structure (event.adevice.*) * \brief Audio device event structure (event.adevice.*)
*/ */
typedef struct SDL_AudioDeviceEvent typedef struct SDL_AudioDeviceEvent
{ {
Uint32 type; /**< SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED */ Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
@@ -528,11 +497,11 @@ typedef struct SDL_AudioDeviceEvent
/** /**
* Touch finger event structure (event.tfinger.*) * \brief Touch finger event structure (event.tfinger.*)
*/ */
typedef struct SDL_TouchFingerEvent typedef struct SDL_TouchFingerEvent
{ {
Uint32 type; /**< SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP */ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId; SDL_FingerID fingerId;
@@ -546,11 +515,11 @@ typedef struct SDL_TouchFingerEvent
/** /**
* Multiple Finger Gesture Event (event.mgesture.*) * \brief Multiple Finger Gesture Event (event.mgesture.*)
*/ */
typedef struct SDL_MultiGestureEvent typedef struct SDL_MultiGestureEvent
{ {
Uint32 type; /**< SDL_MULTIGESTURE */ Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
float dTheta; float dTheta;
@@ -563,11 +532,11 @@ typedef struct SDL_MultiGestureEvent
/** /**
* Dollar Gesture Event (event.dgesture.*) * \brief Dollar Gesture Event (event.dgesture.*)
*/ */
typedef struct SDL_DollarGestureEvent typedef struct SDL_DollarGestureEvent
{ {
Uint32 type; /**< SDL_DOLLARGESTURE or SDL_DOLLARRECORD */ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId; SDL_GestureID gestureId;
@@ -579,15 +548,13 @@ typedef struct SDL_DollarGestureEvent
/** /**
* An event used to request a file open by the system (event.drop.*) * \brief An event used to request a file open by the system (event.drop.*)
*
* This event is enabled by default, you can disable it with SDL_EventState(). * This event is enabled by default, you can disable it with SDL_EventState().
* * \note If this event is enabled, you must free the filename in the event.
* If this event is enabled, you must free the filename in the event.
*/ */
typedef struct SDL_DropEvent typedef struct SDL_DropEvent
{ {
Uint32 type; /**< SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE */ Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
Uint32 windowID; /**< The window that was dropped on, if any */ Uint32 windowID; /**< The window that was dropped on, if any */
@@ -595,11 +562,11 @@ typedef struct SDL_DropEvent
/** /**
* Sensor event structure (event.sensor.*) * \brief Sensor event structure (event.sensor.*)
*/ */
typedef struct SDL_SensorEvent typedef struct SDL_SensorEvent
{ {
Uint32 type; /**< SDL_SENSORUPDATE */ Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The instance ID of the sensor */ Sint32 which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
@@ -607,20 +574,20 @@ typedef struct SDL_SensorEvent
} SDL_SensorEvent; } SDL_SensorEvent;
/** /**
* The "quit requested" event * \brief The "quit requested" event
*/ */
typedef struct SDL_QuitEvent typedef struct SDL_QuitEvent
{ {
Uint32 type; /**< SDL_QUIT */ Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent; } SDL_QuitEvent;
/** /**
* A user-defined event type (event.user.*) * \brief A user-defined event type (event.user.*)
*/ */
typedef struct SDL_UserEvent typedef struct SDL_UserEvent
{ {
Uint32 type; /**< SDL_USEREVENT through SDL_LASTEVENT-1 */ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window if any */ Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */ Sint32 code; /**< User defined event code */
@@ -633,24 +600,20 @@ struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMmsg SDL_SysWMmsg;
/** /**
* A video driver dependent system event (event.syswm.*) * \brief A video driver dependent system event (event.syswm.*)
*
* This event is disabled by default, you can enable it with SDL_EventState() * This event is disabled by default, you can enable it with SDL_EventState()
* *
* If you want to use this event, you should include SDL_syswm.h. * \note If you want to use this event, you should include SDL_syswm.h.
*/ */
typedef struct SDL_SysWMEvent typedef struct SDL_SysWMEvent
{ {
Uint32 type; /**< SDL_SYSWMEVENT */ Uint32 type; /**< ::SDL_SYSWMEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent; } SDL_SysWMEvent;
/** /**
* General event structure * \brief General event structure
*
* The SDL_Event structure is the core of all event handling in SDL. SDL_Event
* is a union of all event structures used in SDL.
*/ */
typedef union SDL_Event typedef union SDL_Event
{ {
@@ -733,7 +696,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL
extern DECLSPEC void SDLCALL SDL_PumpEvents(void); extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
/* @{ */ /* @{ */
typedef enum SDL_eventaction typedef enum
{ {
SDL_ADDEVENT, SDL_ADDEVENT,
SDL_PEEKEVENT, SDL_PEEKEVENT,
@@ -760,15 +723,15 @@ typedef enum SDL_eventaction
* *
* This function is thread-safe. * This function is thread-safe.
* *
* \param events destination buffer for the retrieved events. * \param events destination buffer for the retrieved events
* \param numevents if action is SDL_ADDEVENT, the number of events to add * \param numevents if action is SDL_ADDEVENT, the number of events to add
* back to the event queue; if action is SDL_PEEKEVENT or * back to the event queue; if action is SDL_PEEKEVENT or
* SDL_GETEVENT, the maximum number of events to retrieve. * SDL_GETEVENT, the maximum number of events to retrieve
* \param action action to take; see [[#action|Remarks]] for details. * \param action action to take; see [[#action|Remarks]] for details
* \param minType minimum value of the event type to be considered; * \param minType minimum value of the event type to be considered;
* SDL_FIRSTEVENT is a safe choice. * SDL_FIRSTEVENT is a safe choice
* \param maxType maximum value of the event type to be considered; * \param maxType maximum value of the event type to be considered;
* SDL_LASTEVENT is a safe choice. * SDL_LASTEVENT is a safe choice
* \returns the number of events actually stored or a negative error code on * \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -789,7 +752,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
* If you need to check for a range of event types, use SDL_HasEvents() * If you need to check for a range of event types, use SDL_HasEvents()
* instead. * instead.
* *
* \param type the type of event to be queried; see SDL_EventType for details. * \param type the type of event to be queried; see SDL_EventType for details
* \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
* events matching `type` are not present. * events matching `type` are not present.
* *
@@ -806,9 +769,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
* If you need to check for a single event type, use SDL_HasEvent() instead. * If you need to check for a single event type, use SDL_HasEvent() instead.
* *
* \param minType the low end of event type to be queried, inclusive; see * \param minType the low end of event type to be queried, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \param maxType the high end of event type to be queried, inclusive; see * \param maxType the high end of event type to be queried, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
* present, or SDL_FALSE if not. * present, or SDL_FALSE if not.
* *
@@ -832,7 +795,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
* sure that all pending OS events are flushed, you can call SDL_PumpEvents() * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
* on the main thread immediately before the flush call. * on the main thread immediately before the flush call.
* *
* \param type the type of event to be cleared; see SDL_EventType for details. * \param type the type of event to be cleared; see SDL_EventType for details
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -855,9 +818,9 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
* on the main thread immediately before the flush call. * on the main thread immediately before the flush call.
* *
* \param minType the low end of event type to be cleared, inclusive; see * \param minType the low end of event type to be cleared, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \param maxType the high end of event type to be cleared, inclusive; see * \param maxType the high end of event type to be cleared, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -898,7 +861,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
* ``` * ```
* *
* \param event the SDL_Event structure to be filled with the next event from * \param event the SDL_Event structure to be filled with the next event from
* the queue, or NULL. * the queue, or NULL
* \returns 1 if there is a pending event or 0 if there are none available. * \returns 1 if there is a pending event or 0 if there are none available.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -922,7 +885,7 @@ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
* this function in the thread that initialized the video subsystem. * this function in the thread that initialized the video subsystem.
* *
* \param event the SDL_Event structure to be filled in with the next event * \param event the SDL_Event structure to be filled in with the next event
* from the queue, or NULL. * from the queue, or NULL
* \returns 1 on success or 0 if there was an error while waiting for events; * \returns 1 on success or 0 if there was an error while waiting for events;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -945,9 +908,9 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
* this function in the thread that initialized the video subsystem. * this function in the thread that initialized the video subsystem.
* *
* \param event the SDL_Event structure to be filled in with the next event * \param event the SDL_Event structure to be filled in with the next event
* from the queue, or NULL. * from the queue, or NULL
* \param timeout the maximum number of milliseconds to wait for the next * \param timeout the maximum number of milliseconds to wait for the next
* available event. * available event
* \returns 1 on success or 0 if there was an error while waiting for events; * \returns 1 on success or 0 if there was an error while waiting for events;
* call SDL_GetError() for more information. This also returns 0 if * call SDL_GetError() for more information. This also returns 0 if
* the timeout elapsed without an event arriving. * the timeout elapsed without an event arriving.
@@ -982,7 +945,7 @@ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
* get an event type that does not conflict with other code that also wants * get an event type that does not conflict with other code that also wants
* its own custom event types. * its own custom event types.
* *
* \param event the SDL_Event to be added to the queue. * \param event the SDL_Event to be added to the queue
* \returns 1 on success, 0 if the event was filtered, or a negative error * \returns 1 on success, 0 if the event was filtered, or a negative error
* code on failure; call SDL_GetError() for more information. A * code on failure; call SDL_GetError() for more information. A
* common reason for error is the event queue being full. * common reason for error is the event queue being full.
@@ -998,11 +961,11 @@ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
/** /**
* A function pointer used for callbacks that watch the event queue. * A function pointer used for callbacks that watch the event queue.
* *
* \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * \param userdata what was passed as `userdata` to SDL_SetEventFilter()
* SDL_AddEventWatch, etc. * or SDL_AddEventWatch, etc
* \param event the event that triggered the callback. * \param event the event that triggered the callback
* \returns 1 to permit event to be added to the queue, and 0 to disallow it. * \returns 1 to permit event to be added to the queue, and 0 to disallow
* When used with SDL_AddEventWatch, the return value is ignored. * it. When used with SDL_AddEventWatch, the return value is ignored.
* *
* \sa SDL_SetEventFilter * \sa SDL_SetEventFilter
* \sa SDL_AddEventWatch * \sa SDL_AddEventWatch
@@ -1025,7 +988,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
* application at the next event poll. * application at the next event poll.
* *
* There is one caveat when dealing with the SDL_QuitEvent event type. The * 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 * 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 * application window. If the event filter returns 1, then the window will be
* closed, otherwise the window will remain open if possible. * closed, otherwise the window will remain open if possible.
@@ -1040,8 +1003,8 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* the event filter, but events pushed onto the queue with SDL_PeepEvents() do * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
* not. * not.
* *
* \param filter An SDL_EventFilter function to call when an event happens. * \param filter An SDL_EventFilter function to call when an event happens
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1060,9 +1023,9 @@ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
* This function can be used to "chain" filters, by saving the existing filter * This function can be used to "chain" filters, by saving the existing filter
* before replacing it with a function that will call that saved filter. * before replacing it with a function that will call that saved filter.
* *
* \param filter the current callback function will be stored here. * \param filter the current callback function will be stored here
* \param userdata the pointer that is passed to the current event filter will * \param userdata the pointer that is passed to the current event filter will
* be stored here. * be stored here
* \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set. * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1091,7 +1054,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
* through SDL_PeepEvents(). * through SDL_PeepEvents().
* *
* \param filter an SDL_EventFilter function to call when an event happens. * \param filter an SDL_EventFilter function to call when an event happens.
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1107,8 +1070,8 @@ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
* This function takes the same input as SDL_AddEventWatch() to identify and * This function takes the same input as SDL_AddEventWatch() to identify and
* delete the corresponding callback. * delete the corresponding callback.
* *
* \param filter the function originally passed to SDL_AddEventWatch(). * \param filter the function originally passed to SDL_AddEventWatch()
* \param userdata the pointer originally passed to SDL_AddEventWatch(). * \param userdata the pointer originally passed to SDL_AddEventWatch()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1125,8 +1088,8 @@ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
* this function does not change the filter permanently, it only uses the * this function does not change the filter permanently, it only uses the
* supplied filter until this function returns. * supplied filter until this function returns.
* *
* \param filter the SDL_EventFilter function to call when an event happens. * \param filter the SDL_EventFilter function to call when an event happens
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1152,8 +1115,8 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
* from the event queue and will not be filtered * from the event queue and will not be filtered
* - `SDL_ENABLE`: the event will be processed normally * - `SDL_ENABLE`: the event will be processed normally
* *
* \param type the type of event; see SDL_EventType for details. * \param type the type of event; see SDL_EventType for details
* \param state how to process the event. * \param state how to process the event
* \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state * \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state
* of the event before this function makes any changes to it. * of the event before this function makes any changes to it.
* *
@@ -1175,7 +1138,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
* Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or * Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or
* 0xFFFFFFFF), but is clearer to write. * 0xFFFFFFFF), but is clearer to write.
* *
* \param numevents the number of events to be allocated. * \param numevents the number of events to be allocated
* \returns the beginning event number, or (Uint32)-1 if there are not enough * \returns the beginning event number, or (Uint32)-1 if there are not enough
* user-defined events left. * user-defined events left.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryFilesystem * \file SDL_filesystem.h
* *
* Include file for filesystem SDL API functions * \brief Include file for filesystem SDL API functions
*/ */
#ifndef SDL_filesystem_h_ #ifndef SDL_filesystem_h_
@@ -126,8 +126,8 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
* The pointer returned is owned by the caller. Please call SDL_free() on the * The pointer returned is owned by the caller. Please call SDL_free() on the
* pointer when done with it. * pointer when done with it.
* *
* \param org the name of your organization. * \param org the name of your organization
* \param app the name of your application. * \param app the name of your application
* \returns a UTF-8 string of the user directory in platform-dependent * \returns a UTF-8 string of the user directory in platform-dependent
* notation. NULL if there's a problem (creating directory failed, * notation. NULL if there's a problem (creating directory failed,
* etc.). * etc.).

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,8 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: GameController */
/** /**
* # CategoryGameController * \file SDL_gamecontroller.h
* *
* Include file for SDL game controller event handling * Include file for SDL game controller event handling
*/ */
@@ -46,7 +44,7 @@ extern "C" {
* \file SDL_gamecontroller.h * \file SDL_gamecontroller.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
* for game controllers, and load appropriate drivers. * for game controllers, and load appropriate drivers.
* *
* If you would like to receive controller updates while the application * If you would like to receive controller updates while the application
@@ -60,7 +58,7 @@ extern "C" {
struct _SDL_GameController; struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController; typedef struct _SDL_GameController SDL_GameController;
typedef enum SDL_GameControllerType typedef enum
{ {
SDL_CONTROLLER_TYPE_UNKNOWN = 0, SDL_CONTROLLER_TYPE_UNKNOWN = 0,
SDL_CONTROLLER_TYPE_XBOX360, SDL_CONTROLLER_TYPE_XBOX360,
@@ -79,7 +77,7 @@ typedef enum SDL_GameControllerType
SDL_CONTROLLER_TYPE_MAX SDL_CONTROLLER_TYPE_MAX
} SDL_GameControllerType; } SDL_GameControllerType;
typedef enum SDL_GameControllerBindType typedef enum
{ {
SDL_CONTROLLER_BINDTYPE_NONE = 0, SDL_CONTROLLER_BINDTYPE_NONE = 0,
SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_BUTTON,
@@ -146,10 +144,6 @@ typedef struct SDL_GameControllerButtonBind
* If a new mapping is loaded for an already known controller GUID, the later * If a new mapping is loaded for an already known controller GUID, the later
* version will overwrite the one currently loaded. * version will overwrite the one currently loaded.
* *
* If this function is called before SDL_Init, SDL will generate an
* SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged
* in at the time that SDL_Init is called.
*
* Mappings not belonging to the current platform or with no platform field * Mappings not belonging to the current platform or with no platform field
* specified will be ignored (i.e. mappings for Linux will be ignored in * specified will be ignored (i.e. mappings for Linux will be ignored in
* Windows, etc). * Windows, etc).
@@ -158,8 +152,8 @@ typedef struct SDL_GameControllerButtonBind
* processing it, so take this into consideration if you are in a memory * processing it, so take this into consideration if you are in a memory
* constrained environment. * constrained environment.
* *
* \param rw the data stream for the mappings to be added. * \param rw the data stream for the mappings to be added
* \param freerw non-zero to close the stream after being read. * \param freerw non-zero to close the stream after being read
* \returns the number of mappings added or -1 on error; call SDL_GetError() * \returns the number of mappings added or -1 on error; call SDL_GetError()
* for more information. * for more information.
* *
@@ -168,13 +162,11 @@ typedef struct SDL_GameControllerButtonBind
* \sa SDL_GameControllerAddMapping * \sa SDL_GameControllerAddMapping
* \sa SDL_GameControllerAddMappingsFromFile * \sa SDL_GameControllerAddMappingsFromFile
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
* \sa SDL_CONTROLLERDEVICEADDED
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/** /**
* Load a set of mappings from a file, filtered by the current * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
* SDL_GetPlatform()
* *
* Convenience macro. * Convenience macro.
*/ */
@@ -198,11 +190,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
* "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7" * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
* ``` * ```
* *
* If this function is called before SDL_Init, SDL will generate an * \param mappingString the mapping string
* SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged
* in at the time that SDL_Init is called.
*
* \param mappingString the mapping string.
* \returns 1 if a new mapping is added, 0 if an existing mapping is updated, * \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
* -1 on error; call SDL_GetError() for more information. * -1 on error; call SDL_GetError() for more information.
* *
@@ -210,7 +198,6 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
* *
* \sa SDL_GameControllerMapping * \sa SDL_GameControllerMapping
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
* \sa SDL_CONTROLLERDEVICEADDED
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
@@ -238,7 +225,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_ind
* *
* The returned string must be freed with SDL_free(). * The returned string must be freed with SDL_free().
* *
* \param guid a structure containing the GUID for which a mapping is desired. * \param guid a structure containing the GUID for which a mapping is desired
* \returns a mapping string or NULL on error; call SDL_GetError() for more * \returns a mapping string or NULL on error; call SDL_GetError() for more
* information. * information.
* *
@@ -257,7 +244,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID
* Details about mappings are discussed with SDL_GameControllerAddMapping(). * Details about mappings are discussed with SDL_GameControllerAddMapping().
* *
* \param gamecontroller the game controller you want to get the current * \param gamecontroller the game controller you want to get the current
* mapping for. * mapping for
* \returns a string that has the controller's mapping or NULL if no mapping * \returns a string that has the controller's mapping or NULL if no mapping
* is available; call SDL_GetError() for more information. * is available; call SDL_GetError() for more information.
* *
@@ -275,7 +262,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gam
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, up to * \param joystick_index the device_index of a device, up to
* SDL_NumJoysticks(). * SDL_NumJoysticks()
* \returns SDL_TRUE if the given joystick is supported by the game controller * \returns SDL_TRUE if the given joystick is supported by the game controller
* interface, SDL_FALSE if it isn't or it's an invalid index. * interface, SDL_FALSE if it isn't or it's an invalid index.
* *
@@ -295,7 +282,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the implementation-dependent name for the game controller, or NULL * \returns the implementation-dependent name for the game controller, or NULL
* if there is no name or the index is invalid. * if there is no name or the index is invalid.
* *
@@ -316,7 +303,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the implementation-dependent path for the game controller, or NULL * \returns the implementation-dependent path for the game controller, or NULL
* if there is no path or the index is invalid. * if there is no path or the index is invalid.
* *
@@ -332,7 +319,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_
* This can be called before any controllers are opened. * This can be called before any controllers are opened.
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the controller type. * \returns the controller type.
* *
* \since This function is available since SDL 2.0.12. * \since This function is available since SDL 2.0.12.
@@ -345,7 +332,7 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(in
* This can be called before any controllers are opened. * This can be called before any controllers are opened.
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
* no mapping is available. * no mapping is available.
* *
@@ -365,7 +352,7 @@ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joysti
* be used there instead. * be used there instead.
* *
* \param joystick_index the device_index of a device, up to * \param joystick_index the device_index of a device, up to
* SDL_NumJoysticks(). * SDL_NumJoysticks()
* \returns a gamecontroller identifier or NULL if an error occurred; call * \returns a gamecontroller identifier or NULL if an error occurred; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -380,7 +367,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
/** /**
* Get the SDL_GameController associated with an instance id. * Get the SDL_GameController associated with an instance id.
* *
* \param joyid the instance id to get the SDL_GameController for. * \param joyid the instance id to get the SDL_GameController for
* \returns an SDL_GameController on success or NULL on failure; call * \returns an SDL_GameController on success or NULL on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -412,7 +399,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in
* it takes a controller identifier instead of the (unstable) device index. * it takes a controller identifier instead of the (unstable) device index.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns the implementation dependent name for the game controller, or NULL * \returns the implementation dependent name for the game controller, or NULL
* if there is no name or the identifier passed is invalid. * if there is no name or the identifier passed is invalid.
* *
@@ -430,7 +417,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
* it takes a controller identifier instead of the (unstable) device index. * it takes a controller identifier instead of the (unstable) device index.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns the implementation dependent path for the game controller, or NULL * \returns the implementation dependent path for the game controller, or NULL
* if there is no path or the identifier passed is invalid. * if there is no path or the identifier passed is invalid.
* *
@@ -540,8 +527,8 @@ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameControl
/** /**
* Get the Steam Input handle of an opened controller, if available. * Get the Steam Input handle of an opened controller, if available.
* *
* Returns an InputHandle_t for the controller that can be used with Steam * Returns an InputHandle_t for the controller that can be used with Steam Input API:
* Input API: https://partner.steamgames.com/doc/api/ISteamInput * https://partner.steamgames.com/doc/api/ISteamInput
* *
* \param gamecontroller the game controller object to query. * \param gamecontroller the game controller object to query.
* \returns the gamepad handle, or 0 if unavailable. * \returns the gamepad handle, or 0 if unavailable.
@@ -555,7 +542,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameControll
* Check if a controller has been opened and is currently connected. * Check if a controller has been opened and is currently connected.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns SDL_TRUE if the controller has been opened and is currently * \returns SDL_TRUE if the controller has been opened and is currently
* connected, or SDL_FALSE if not. * connected, or SDL_FALSE if not.
* *
@@ -580,7 +567,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameControlle
* cause SDL to crash. * cause SDL to crash.
* *
* \param gamecontroller the game controller object that you want to get a * \param gamecontroller the game controller object that you want to get a
* joystick from. * joystick from
* \returns a SDL_Joystick object; call SDL_GetError() for more information. * \returns a SDL_Joystick object; call SDL_GetError() for more information.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -597,7 +584,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont
* Any number can be passed to SDL_GameControllerEventState(), but only -1, 0, * Any number can be passed to SDL_GameControllerEventState(), but only -1, 0,
* and 1 will have any effect. Other numbers will just be returned. * and 1 will have any effect. Other numbers will just be returned.
* *
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`. * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
* \returns the same value passed to the function, with exception to -1 * \returns the same value passed to the function, with exception to -1
* (SDL_QUERY), which will return the current state. * (SDL_QUERY), which will return the current state.
* *
@@ -622,17 +609,15 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
/** /**
* The list of axes available from a controller * The list of axes available from a controller
* *
* Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
* SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though * and are centered within ~8000 of zero, though advanced UI will allow users to set
* advanced UI will allow users to set or autodetect the dead zone, which * or autodetect the dead zone, which varies between controllers.
* varies between controllers.
* *
* Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX
* pressed) when reported by SDL_GameControllerGetAxis(). Note that this is * (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the
* not the same range that will be reported by the lower-level * same range that will be reported by the lower-level SDL_GetJoystickAxis().
* SDL_GetJoystickAxis().
*/ */
typedef enum SDL_GameControllerAxis typedef enum
{ {
SDL_CONTROLLER_AXIS_INVALID = -1, SDL_CONTROLLER_AXIS_INVALID = -1,
SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_LEFTX,
@@ -656,7 +641,7 @@ typedef enum SDL_GameControllerAxis
* `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`, * `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`,
* respectively. * respectively.
* *
* \param str string representing a SDL_GameController axis. * \param str string representing a SDL_GameController axis
* \returns the SDL_GameControllerAxis enum corresponding to the input string, * \returns the SDL_GameControllerAxis enum corresponding to the input string,
* or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
* *
@@ -671,7 +656,7 @@ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromStri
* *
* The caller should not SDL_free() the returned string. * The caller should not SDL_free() the returned string.
* *
* \param axis an enum value for a given SDL_GameControllerAxis. * \param axis an enum value for a given SDL_GameControllerAxis
* \returns a string for the given axis, or NULL if an invalid axis is * \returns a string for the given axis, or NULL if an invalid axis is
* specified. The string returned is of the format used by * specified. The string returned is of the format used by
* SDL_GameController mapping strings. * SDL_GameController mapping strings.
@@ -685,8 +670,8 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameC
/** /**
* Get the SDL joystick layer binding for a controller axis mapping. * Get the SDL joystick layer binding for a controller axis mapping.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param axis an axis enum value (one of the SDL_GameControllerAxis values). * \param axis an axis enum value (one of the SDL_GameControllerAxis values)
* \returns a SDL_GameControllerButtonBind describing the bind. On failure * \returns a SDL_GameControllerButtonBind describing the bind. On failure
* (like the given Controller axis doesn't exist on the device), its * (like the given Controller axis doesn't exist on the device), its
* `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
@@ -705,8 +690,8 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
* This merely reports whether the controller's mapping defined this axis, as * This merely reports whether the controller's mapping defined this axis, as
* that is all the information SDL has about the physical device. * that is all the information SDL has about the physical device.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param axis an axis enum value (an SDL_GameControllerAxis value). * \param axis an axis enum value (an SDL_GameControllerAxis value)
* \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise. * \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -719,15 +704,16 @@ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameController
* *
* The axis indices start at index 0. * The axis indices start at index 0.
* *
* For thumbsticks, the state is a value ranging from -32768 (up/left) to * For thumbsticks, the state is a value ranging from -32768 (up/left)
* 32767 (down/right). * to 32767 (down/right).
* *
* Triggers range from 0 when released to 32767 when fully pressed, and never * Triggers range from 0 when released to 32767 when fully pressed, and
* return a negative value. Note that this differs from the value reported by * never return a negative value. Note that this differs from the value
* the lower-level SDL_JoystickGetAxis(), which normally uses the full range. * reported by the lower-level SDL_GetJoystickAxis(), which normally uses
* the full range.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param axis an axis index (one of the SDL_GameControllerAxis values). * \param axis an axis index (one of the SDL_GameControllerAxis values)
* \returns axis state (including 0) on success or 0 (also) on failure; call * \returns axis state (including 0) on success or 0 (also) on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -741,7 +727,7 @@ SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameController
/** /**
* The list of buttons available from a controller * The list of buttons available from a controller
*/ */
typedef enum SDL_GameControllerButton typedef enum
{ {
SDL_CONTROLLER_BUTTON_INVALID = -1, SDL_CONTROLLER_BUTTON_INVALID = -1,
SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_A,
@@ -776,7 +762,7 @@ typedef enum SDL_GameControllerButton
* SDL_GameController mapping. You do not normally need to call this function * SDL_GameController mapping. You do not normally need to call this function
* unless you are parsing SDL_GameController mappings in your own code. * unless you are parsing SDL_GameController mappings in your own code.
* *
* \param str string representing a SDL_GameController axis. * \param str string representing a SDL_GameController axis
* \returns the SDL_GameControllerButton enum corresponding to the input * \returns the SDL_GameControllerButton enum corresponding to the input
* string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
* *
@@ -789,7 +775,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom
* *
* The caller should not SDL_free() the returned string. * The caller should not SDL_free() the returned string.
* *
* \param button an enum value for a given SDL_GameControllerButton. * \param button an enum value for a given SDL_GameControllerButton
* \returns a string for the given button, or NULL if an invalid button is * \returns a string for the given button, or NULL if an invalid button is
* specified. The string returned is of the format used by * specified. The string returned is of the format used by
* SDL_GameController mapping strings. * SDL_GameController mapping strings.
@@ -803,8 +789,8 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_Gam
/** /**
* Get the SDL joystick layer binding for a controller button mapping. * Get the SDL joystick layer binding for a controller button mapping.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button an button enum value (an SDL_GameControllerButton value). * \param button an button enum value (an SDL_GameControllerButton value)
* \returns a SDL_GameControllerButtonBind describing the bind. On failure * \returns a SDL_GameControllerButtonBind describing the bind. On failure
* (like the given Controller button doesn't exist on the device), * (like the given Controller button doesn't exist on the device),
* its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
@@ -823,8 +809,8 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
* This merely reports whether the controller's mapping defined this button, * This merely reports whether the controller's mapping defined this button,
* as that is all the information SDL has about the physical device. * as that is all the information SDL has about the physical device.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button a button enum value (an SDL_GameControllerButton value). * \param button a button enum value (an SDL_GameControllerButton value)
* \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise. * \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -835,8 +821,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController
/** /**
* Get the current state of a button on a game controller. * Get the current state of a button on a game controller.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button a button index (one of the SDL_GameControllerButton values). * \param button a button index (one of the SDL_GameControllerButton values)
* \returns 1 for pressed state or 0 for not pressed state or error; call * \returns 1 for pressed state or 0 for not pressed state or error; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -872,8 +858,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameControll
/** /**
* Return whether a game controller has a particular sensor. * Return whether a game controller has a particular sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise. * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -883,9 +869,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController
/** /**
* Set whether data reporting for a game controller sensor is enabled. * Set whether data reporting for a game controller sensor is enabled.
* *
* \param gamecontroller The controller to update. * \param gamecontroller The controller to update
* \param type The type of sensor to enable/disable. * \param type The type of sensor to enable/disable
* \param enabled Whether data reporting should be enabled. * \param enabled Whether data reporting should be enabled
* \returns 0 or -1 if an error occurred. * \returns 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -895,8 +881,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameControlle
/** /**
* Query whether sensor data reporting is enabled for a game controller. * Query whether sensor data reporting is enabled for a game controller.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -907,8 +893,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameContr
* Get the data rate (number of events per second) of a game controller * Get the data rate (number of events per second) of a game controller
* sensor. * sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \return the data rate, or 0.0f if the data rate is not available. * \return the data rate, or 0.0f if the data rate is not available.
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
@@ -921,10 +907,10 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* See SDL_sensor.h for the details for each type of sensor. * See SDL_sensor.h for the details for each type of sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \return 0 or -1 if an error occurred. * \return 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -938,12 +924,12 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* See SDL_sensor.h for the details for each type of sensor. * See SDL_sensor.h for the details for each type of sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \param timestamp A pointer filled with the timestamp in microseconds of the * \param timestamp A pointer filled with the timestamp in microseconds of the
* current sensor reading if available, or 0 if not. * current sensor reading if available, or 0 if not
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \return 0 or -1 if an error occurred. * \return 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
@@ -956,13 +942,13 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_Gam
* Each call to this function cancels any previous rumble effect, and calling * Each call to this function cancels any previous rumble effect, and calling
* it with 0 intensity stops any rumbling. * it with 0 intensity stops any rumbling.
* *
* \param gamecontroller The controller to vibrate. * \param gamecontroller The controller to vibrate
* \param low_frequency_rumble The intensity of the low frequency (left) * \param low_frequency_rumble The intensity of the low frequency (left)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param high_frequency_rumble The intensity of the high frequency (right) * \param high_frequency_rumble The intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if rumble isn't supported on this controller. * \returns 0, or -1 if rumble isn't supported on this controller
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
* *
@@ -981,13 +967,13 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
* want the (more common) whole-controller rumble, use * want the (more common) whole-controller rumble, use
* SDL_GameControllerRumble() instead. * SDL_GameControllerRumble() instead.
* *
* \param gamecontroller The controller to vibrate. * \param gamecontroller The controller to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0 * \param left_rumble The intensity of the left trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param right_rumble The intensity of the right trigger rumble motor, from 0 * \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this controller. * \returns 0, or -1 if trigger rumble isn't supported on this controller
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *
@@ -998,9 +984,9 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController
/** /**
* Query whether a game controller has an LED. * Query whether a game controller has an LED.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have a * \returns SDL_TRUE, or SDL_FALSE if this controller does not have a
* modifiable LED. * modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1009,9 +995,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *ga
/** /**
* Query whether a game controller has rumble support. * Query whether a game controller has rumble support.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble * \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble
* support. * support
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1022,9 +1008,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController
/** /**
* Query whether a game controller has rumble support on triggers. * Query whether a game controller has rumble support on triggers.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger * \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger
* rumble support. * rumble support
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1035,11 +1021,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameCon
/** /**
* Update a game controller's LED color. * Update a game controller's LED color.
* *
* \param gamecontroller The controller to update. * \param gamecontroller The controller to update
* \param red The intensity of the red LED. * \param red The intensity of the red LED
* \param green The intensity of the green LED. * \param green The intensity of the green LED
* \param blue The intensity of the blue LED. * \param blue The intensity of the blue LED
* \returns 0, or -1 if this controller does not have a modifiable LED. * \returns 0, or -1 if this controller does not have a modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1048,11 +1034,11 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecon
/** /**
* Send a controller specific effect packet * Send a controller specific effect packet
* *
* \param gamecontroller The controller to affect. * \param gamecontroller The controller to affect
* \param data The data to send to the controller. * \param data The data to send to the controller
* \param size The size of the data to send to the controller. * \param size The size of the data to send to the controller
* \returns 0, or -1 if this controller or driver doesn't support effect * \returns 0, or -1 if this controller or driver doesn't support effect
* packets. * packets
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
@@ -1062,7 +1048,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gam
* Close a game controller previously opened with SDL_GameControllerOpen(). * Close a game controller previously opened with SDL_GameControllerOpen().
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1074,9 +1060,9 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
* Return the sfSymbolsName for a given button on a game controller on Apple * Return the sfSymbolsName for a given button on a game controller on Apple
* platforms. * platforms.
* *
* \param gamecontroller the controller to query. * \param gamecontroller the controller to query
* \param button a button on the game controller. * \param button a button on the game controller
* \returns the sfSymbolsName or NULL if the name can't be found. * \returns the sfSymbolsName or NULL if the name can't be found
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1088,9 +1074,9 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForBu
* Return the sfSymbolsName for a given axis on a game controller on Apple * Return the sfSymbolsName for a given axis on a game controller on Apple
* platforms. * platforms.
* *
* \param gamecontroller the controller to query. * \param gamecontroller the controller to query
* \param axis an axis on the game controller. * \param axis an axis on the game controller
* \returns the sfSymbolsName or NULL if the name can't be found. * \returns the sfSymbolsName or NULL if the name can't be found
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryGesture * \file SDL_gesture.h
* *
* Include file for SDL gesture event handling. * Include file for SDL gesture event handling.
*/ */
@@ -51,7 +51,7 @@ typedef Sint64 SDL_GestureID;
* If the parameter `touchId` is -1 (i.e., all devices), this function will * If the parameter `touchId` is -1 (i.e., all devices), this function will
* always return 1, regardless of whether there actually are any devices. * always return 1, regardless of whether there actually are any devices.
* *
* \param touchId the touch device id, or -1 for all touch devices. * \param touchId the touch device id, or -1 for all touch devices
* \returns 1 on success or 0 if the specified device could not be found. * \returns 1 on success or 0 if the specified device could not be found.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -64,7 +64,7 @@ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
/** /**
* Save all currently loaded Dollar Gesture templates. * Save all currently loaded Dollar Gesture templates.
* *
* \param dst a SDL_RWops to save to. * \param dst a SDL_RWops to save to
* \returns the number of saved templates on success or 0 on failure; call * \returns the number of saved templates on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -78,8 +78,8 @@ extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
/** /**
* Save a currently loaded Dollar Gesture template. * Save a currently loaded Dollar Gesture template.
* *
* \param gestureId a gesture id. * \param gestureId a gesture id
* \param dst a SDL_RWops to save to. * \param dst a SDL_RWops to save to
* \returns 1 on success or 0 on failure; call SDL_GetError() for more * \returns 1 on success or 0 on failure; call SDL_GetError() for more
* information. * information.
* *
@@ -94,8 +94,8 @@ extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_R
/** /**
* Load Dollar Gesture templates from a file. * Load Dollar Gesture templates from a file.
* *
* \param touchId a touch id. * \param touchId a touch id
* \param src a SDL_RWops to load from. * \param src a SDL_RWops to load from
* \returns the number of loaded templates on success or a negative error code * \returns the number of loaded templates on success or a negative error code
* (or 0) on failure; call SDL_GetError() for more information. * (or 0) on failure; call SDL_GetError() for more information.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,13 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: GUID */
/** /**
* # CategoryGUID * \file SDL_guid.h
* *
* A GUID is a 128-bit value that represents something that is uniquely * Include file for handling ::SDL_GUID values.
* identifiable by this value: "globally unique."
*/ */
#ifndef SDL_guid_h_ #ifndef SDL_guid_h_
@@ -41,38 +38,34 @@ extern "C" {
#endif #endif
/** /**
* An SDL_GUID is a 128-bit identifier. * An SDL_GUID is a 128-bit identifier for an input device that
* identifies that device across runs of SDL programs on the same
* platform. If the device is detached and then re-attached to a
* different port, or if the base system is rebooted, the device
* should still report the same GUID.
* *
* This is an acronym for "Globally Unique ID." * GUIDs are as precise as possible but are not guaranteed to
* distinguish physically distinct but equivalent devices. For
* example, two game controllers from the same vendor with the same
* product ID and revision may have the same GUID.
* *
* While a GUID can be used to assign a unique value to almost anything, in * GUIDs may be platform-dependent (i.e., the same device may report
* SDL these are largely used to identify input devices across runs of SDL * different GUIDs on different operating systems).
* programs on the same platform.If the device is detached and then
* re-attached to a different port, or if the base system is rebooted, the
* device should still report the same GUID.
*
* GUIDs are as precise as possible but are not guaranteed to distinguish
* physically distinct but equivalent devices. For example, two game
* controllers from the same vendor with the same product ID and revision may
* have the same GUID.
*
* GUIDs may be platform-dependent (i.e., the same device may report different
* GUIDs on different operating systems).
*/ */
typedef struct SDL_GUID { typedef struct {
Uint8 data[16]; Uint8 data[16];
} SDL_GUID; } SDL_GUID;
/* Function prototypes */ /* Function prototypes */
/** /**
* Get an ASCII string representation for a given SDL_GUID. * Get an ASCII string representation for a given ::SDL_GUID.
* *
* You should supply at least 33 bytes for pszGUID. * You should supply at least 33 bytes for pszGUID.
* *
* \param guid the SDL_GUID you wish to convert to string. * \param guid the ::SDL_GUID you wish to convert to string
* \param pszGUID buffer in which to write the ASCII string. * \param pszGUID buffer in which to write the ASCII string
* \param cbGUID the size of pszGUID. * \param cbGUID the size of pszGUID
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *
@@ -81,14 +74,14 @@ typedef struct SDL_GUID {
extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
/** /**
* Convert a GUID string into a SDL_GUID structure. * Convert a GUID string into a ::SDL_GUID structure.
* *
* Performs no error checking. If this function is given a string containing * Performs no error checking. If this function is given a string containing
* an invalid GUID, the function will silently succeed, but the GUID generated * an invalid GUID, the function will silently succeed, but the GUID generated
* will not be useful. * will not be useful.
* *
* \param pchGUID string containing an ASCII representation of a GUID. * \param pchGUID string containing an ASCII representation of a GUID
* \returns a SDL_GUID structure. * \returns a ::SDL_GUID structure.
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,25 +20,24 @@
*/ */
/** /**
* # CategoryHaptic * \file SDL_haptic.h
* *
* SDL haptic subsystem allows you to control haptic (force feedback) devices. * \brief The SDL haptic subsystem allows you to control haptic (force feedback)
* devices.
* *
* The basic usage is as follows: * The basic usage is as follows:
* * - Initialize the subsystem (::SDL_INIT_HAPTIC).
* - Initialize the subsystem (SDL_INIT_HAPTIC).
* - Open a haptic device. * - Open a haptic device.
* - SDL_HapticOpen() to open from index. * - SDL_HapticOpen() to open from index.
* - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - SDL_HapticOpenFromJoystick() to open from an existing joystick.
* - Create an effect (SDL_HapticEffect). * - Create an effect (::SDL_HapticEffect).
* - Upload the effect with SDL_HapticNewEffect(). * - Upload the effect with SDL_HapticNewEffect().
* - Run the effect with SDL_HapticRunEffect(). * - Run the effect with SDL_HapticRunEffect().
* - (optional) Free the effect with SDL_HapticDestroyEffect(). * - (optional) Free the effect with SDL_HapticDestroyEffect().
* - Close the haptic device with SDL_HapticClose(). * - Close the haptic device with SDL_HapticClose().
* *
* Simple rumble example: * \par Simple rumble example:
* * \code
* ```c
* SDL_Haptic *haptic; * SDL_Haptic *haptic;
* *
* // Open the device * // Open the device
@@ -57,11 +56,10 @@
* *
* // Clean up * // Clean up
* SDL_HapticClose( haptic ); * SDL_HapticClose( haptic );
* ``` * \endcode
* *
* Complete example: * \par Complete example:
* * \code
* ```c
* int test_haptic( SDL_Joystick * joystick ) { * int test_haptic( SDL_Joystick * joystick ) {
* SDL_Haptic *haptic; * SDL_Haptic *haptic;
* SDL_HapticEffect effect; * SDL_HapticEffect effect;
@@ -103,7 +101,7 @@
* *
* return 0; // Success * return 0; // Success
* } * }
* ``` * \endcode
*/ */
#ifndef SDL_haptic_h_ #ifndef SDL_haptic_h_
@@ -156,7 +154,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
/* @{ */ /* @{ */
/** /**
* Constant effect supported. * \brief Constant effect supported.
* *
* Constant haptic effect. * Constant haptic effect.
* *
@@ -165,7 +163,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_CONSTANT (1u<<0) #define SDL_HAPTIC_CONSTANT (1u<<0)
/** /**
* Sine wave effect supported. * \brief Sine wave effect supported.
* *
* Periodic haptic effect that simulates sine waves. * Periodic haptic effect that simulates sine waves.
* *
@@ -174,11 +172,13 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_SINE (1u<<1) #define SDL_HAPTIC_SINE (1u<<1)
/** /**
* Left/Right effect supported. * \brief Left/Right effect supported.
* *
* Haptic effect for direct control over high/low frequency motors. * Haptic effect for direct control over high/low frequency motors.
* *
* \sa SDL_HapticLeftRight * \sa SDL_HapticLeftRight
* \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry,
* we ran out of bits, and this is important for XInput devices.
*/ */
#define SDL_HAPTIC_LEFTRIGHT (1u<<2) #define SDL_HAPTIC_LEFTRIGHT (1u<<2)
@@ -186,7 +186,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
/* #define SDL_HAPTIC_SQUARE (1<<2) */ /* #define SDL_HAPTIC_SQUARE (1<<2) */
/** /**
* Triangle wave effect supported. * \brief Triangle wave effect supported.
* *
* Periodic haptic effect that simulates triangular waves. * Periodic haptic effect that simulates triangular waves.
* *
@@ -195,7 +195,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_TRIANGLE (1u<<3) #define SDL_HAPTIC_TRIANGLE (1u<<3)
/** /**
* Sawtoothup wave effect supported. * \brief Sawtoothup wave effect supported.
* *
* Periodic haptic effect that simulates saw tooth up waves. * Periodic haptic effect that simulates saw tooth up waves.
* *
@@ -204,7 +204,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_SAWTOOTHUP (1u<<4) #define SDL_HAPTIC_SAWTOOTHUP (1u<<4)
/** /**
* Sawtoothdown wave effect supported. * \brief Sawtoothdown wave effect supported.
* *
* Periodic haptic effect that simulates saw tooth down waves. * Periodic haptic effect that simulates saw tooth down waves.
* *
@@ -213,7 +213,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5) #define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5)
/** /**
* Ramp effect supported. * \brief Ramp effect supported.
* *
* Ramp haptic effect. * Ramp haptic effect.
* *
@@ -222,7 +222,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_RAMP (1u<<6) #define SDL_HAPTIC_RAMP (1u<<6)
/** /**
* Spring effect supported - uses axes position. * \brief Spring effect supported - uses axes position.
* *
* Condition haptic effect that simulates a spring. Effect is based on the * Condition haptic effect that simulates a spring. Effect is based on the
* axes position. * axes position.
@@ -232,7 +232,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_SPRING (1u<<7) #define SDL_HAPTIC_SPRING (1u<<7)
/** /**
* Damper effect supported - uses axes velocity. * \brief Damper effect supported - uses axes velocity.
* *
* Condition haptic effect that simulates dampening. Effect is based on the * Condition haptic effect that simulates dampening. Effect is based on the
* axes velocity. * axes velocity.
@@ -242,7 +242,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_DAMPER (1u<<8) #define SDL_HAPTIC_DAMPER (1u<<8)
/** /**
* Inertia effect supported - uses axes acceleration. * \brief Inertia effect supported - uses axes acceleration.
* *
* Condition haptic effect that simulates inertia. Effect is based on the axes * Condition haptic effect that simulates inertia. Effect is based on the axes
* acceleration. * acceleration.
@@ -252,7 +252,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_INERTIA (1u<<9) #define SDL_HAPTIC_INERTIA (1u<<9)
/** /**
* Friction effect supported - uses axes movement. * \brief Friction effect supported - uses axes movement.
* *
* Condition haptic effect that simulates friction. Effect is based on the * Condition haptic effect that simulates friction. Effect is based on the
* axes movement. * axes movement.
@@ -262,7 +262,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_FRICTION (1u<<10) #define SDL_HAPTIC_FRICTION (1u<<10)
/** /**
* Custom effect is supported. * \brief Custom effect is supported.
* *
* User defined custom haptic effect. * User defined custom haptic effect.
*/ */
@@ -273,7 +273,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
/* These last few are features the device has, not effects */ /* These last few are features the device has, not effects */
/** /**
* Device can set global gain. * \brief Device can set global gain.
* *
* Device supports setting the global gain. * Device supports setting the global gain.
* *
@@ -282,7 +282,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_GAIN (1u<<12) #define SDL_HAPTIC_GAIN (1u<<12)
/** /**
* Device can set autocenter. * \brief Device can set autocenter.
* *
* Device supports setting autocenter. * Device supports setting autocenter.
* *
@@ -291,7 +291,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_AUTOCENTER (1u<<13) #define SDL_HAPTIC_AUTOCENTER (1u<<13)
/** /**
* Device can be queried for effect status. * \brief Device can be queried for effect status.
* *
* Device supports querying effect status. * Device supports querying effect status.
* *
@@ -300,7 +300,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
#define SDL_HAPTIC_STATUS (1u<<14) #define SDL_HAPTIC_STATUS (1u<<14)
/** /**
* Device can be paused. * \brief Device can be paused.
* *
* Devices supports being paused. * Devices supports being paused.
* *
@@ -316,32 +316,30 @@ typedef struct _SDL_Haptic SDL_Haptic;
/* @{ */ /* @{ */
/** /**
* Uses polar coordinates for the direction. * \brief Uses polar coordinates for the direction.
* *
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
*/ */
#define SDL_HAPTIC_POLAR 0 #define SDL_HAPTIC_POLAR 0
/** /**
* Uses cartesian coordinates for the direction. * \brief Uses cartesian coordinates for the direction.
* *
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
*/ */
#define SDL_HAPTIC_CARTESIAN 1 #define SDL_HAPTIC_CARTESIAN 1
/** /**
* Uses spherical coordinates for the direction. * \brief Uses spherical coordinates for the direction.
* *
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
*/ */
#define SDL_HAPTIC_SPHERICAL 2 #define SDL_HAPTIC_SPHERICAL 2
/** /**
* Use this value to play an effect on the steering wheel axis. * \brief Use this value to play an effect on the steering wheel axis. This
* * provides better compatibility across platforms and devices as SDL will guess
* This provides better compatibility across platforms and devices as SDL will * the correct axis.
* guess the correct axis.
*
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
*/ */
#define SDL_HAPTIC_STEERING_AXIS 3 #define SDL_HAPTIC_STEERING_AXIS 3
@@ -355,7 +353,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
*/ */
/** /**
* Used to play a device an infinite number of times. * \brief Used to play a device an infinite number of times.
* *
* \sa SDL_HapticRunEffect * \sa SDL_HapticRunEffect
*/ */
@@ -363,82 +361,77 @@ typedef struct _SDL_Haptic SDL_Haptic;
/** /**
* Structure that represents a haptic direction. * \brief Structure that represents a haptic direction.
* *
* This is the direction where the force comes from, instead of the direction * This is the direction where the force comes from,
* in which the force is exerted. * instead of the direction in which the force is exerted.
* *
* Directions can be specified by: * Directions can be specified by:
* - ::SDL_HAPTIC_POLAR : Specified by polar coordinates.
* - ::SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
* - ::SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
* *
* - SDL_HAPTIC_POLAR : Specified by polar coordinates. * Cardinal directions of the haptic device are relative to the positioning
* - SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates. * of the device. North is considered to be away from the user.
* - SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
*
* Cardinal directions of the haptic device are relative to the positioning of
* the device. North is considered to be away from the user.
* *
* The following diagram represents the cardinal directions: * The following diagram represents the cardinal directions:
* \verbatim
.--.
|__| .-------.
|=.| |.-----.|
|--| || ||
| | |'-----'|
|__|~')_____('
[ COMPUTER ]
North (0,-1)
^
|
|
(-1,0) West <----[ HAPTIC ]----> East (1,0)
|
|
v
South (0,1)
[ USER ]
\|||/
(o o)
---ooO-(_)-Ooo---
\endverbatim
* *
* ``` * If type is ::SDL_HAPTIC_POLAR, direction is encoded by hundredths of a
* .--. * degree starting north and turning clockwise. ::SDL_HAPTIC_POLAR only uses
* |__| .-------. * the first \c dir parameter. The cardinal directions would be:
* |=.| |.-----.|
* |--| || ||
* | | |'-----'|
* |__|~')_____('
* [ COMPUTER ]
*
*
* North (0,-1)
* ^
* |
* |
* (-1,0) West <----[ HAPTIC ]----> East (1,0)
* |
* |
* v
* South (0,1)
*
*
* [ USER ]
* \|||/
* (o o)
* ---ooO-(_)-Ooo---
* ```
*
* If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a degree
* starting north and turning clockwise. SDL_HAPTIC_POLAR only uses the first
* `dir` parameter. The cardinal directions would be:
*
* - North: 0 (0 degrees) * - North: 0 (0 degrees)
* - East: 9000 (90 degrees) * - East: 9000 (90 degrees)
* - South: 18000 (180 degrees) * - South: 18000 (180 degrees)
* - West: 27000 (270 degrees) * - West: 27000 (270 degrees)
* *
* If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions (X * If type is ::SDL_HAPTIC_CARTESIAN, direction is encoded by three positions
* axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses the first * (X axis, Y axis and Z axis (with 3 axes)). ::SDL_HAPTIC_CARTESIAN uses
* three `dir` parameters. The cardinal directions would be: * the first three \c dir parameters. The cardinal directions would be:
*
* - North: 0,-1, 0 * - North: 0,-1, 0
* - East: 1, 0, 0 * - East: 1, 0, 0
* - South: 0, 1, 0 * - South: 0, 1, 0
* - West: -1, 0, 0 * - West: -1, 0, 0
* *
* The Z axis represents the height of the effect if supported, otherwise it's * The Z axis represents the height of the effect if supported, otherwise
* unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can * it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you
* use any multiple you want, only the direction matters. * can use any multiple you want, only the direction matters.
*
* If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. The
* first two `dir` parameters are used. The `dir` parameters are as follows
* (all values are in hundredths of degrees):
* *
* If type is ::SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations.
* The first two \c dir parameters are used. The \c dir parameters are as
* follows (all values are in hundredths of degrees):
* - Degrees from (1, 0) rotated towards (0, 1). * - Degrees from (1, 0) rotated towards (0, 1).
* - Degrees towards (0, 0, 1) (device needs at least 3 axes). * - Degrees towards (0, 0, 1) (device needs at least 3 axes).
* *
*
* Example of force coming from the south with all encodings (force coming * Example of force coming from the south with all encodings (force coming
* from the south means the user will have to pull the stick to counteract): * from the south means the user will have to pull the stick to counteract):
* * \code
* ```c
* SDL_HapticDirection direction; * SDL_HapticDirection direction;
* *
* // Cartesian directions * // Cartesian directions
@@ -454,7 +447,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
* // Spherical coordinates * // Spherical coordinates
* direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding * direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding
* direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters. * direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
* ``` * \endcode
* *
* \sa SDL_HAPTIC_POLAR * \sa SDL_HAPTIC_POLAR
* \sa SDL_HAPTIC_CARTESIAN * \sa SDL_HAPTIC_CARTESIAN
@@ -471,12 +464,12 @@ typedef struct SDL_HapticDirection
/** /**
* A structure containing a template for a Constant effect. * \brief A structure containing a template for a Constant effect.
* *
* This struct is exclusively for the SDL_HAPTIC_CONSTANT effect. * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect.
* *
* A constant effect applies a constant force in the specified direction to * A constant effect applies a constant force in the specified direction
* the joystick. * to the joystick.
* *
* \sa SDL_HAPTIC_CONSTANT * \sa SDL_HAPTIC_CONSTANT
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
@@ -484,7 +477,7 @@ typedef struct SDL_HapticDirection
typedef struct SDL_HapticConstant typedef struct SDL_HapticConstant
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_CONSTANT */ Uint16 type; /**< ::SDL_HAPTIC_CONSTANT */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
@@ -506,23 +499,21 @@ typedef struct SDL_HapticConstant
} SDL_HapticConstant; } SDL_HapticConstant;
/** /**
* A structure containing a template for a Periodic effect. * \brief A structure containing a template for a Periodic effect.
* *
* The struct handles the following effects: * The struct handles the following effects:
* - ::SDL_HAPTIC_SINE
* - ::SDL_HAPTIC_LEFTRIGHT
* - ::SDL_HAPTIC_TRIANGLE
* - ::SDL_HAPTIC_SAWTOOTHUP
* - ::SDL_HAPTIC_SAWTOOTHDOWN
* *
* - SDL_HAPTIC_SINE * A periodic effect consists in a wave-shaped effect that repeats itself
* - SDL_HAPTIC_SQUARE * over time. The type determines the shape of the wave and the parameters
* - SDL_HAPTIC_TRIANGLE
* - SDL_HAPTIC_SAWTOOTHUP
* - SDL_HAPTIC_SAWTOOTHDOWN
*
* A periodic effect consists in a wave-shaped effect that repeats itself over
* time. The type determines the shape of the wave and the parameters
* determine the dimensions of the wave. * determine the dimensions of the wave.
* *
* Phase is given by hundredth of a degree meaning that giving the phase a * Phase is given by hundredth of a degree meaning that giving the phase a value
* value of 9000 will displace it 25% of its period. Here are sample values: * of 9000 will displace it 25% of its period. Here are sample values:
*
* - 0: No phase displacement. * - 0: No phase displacement.
* - 9000: Displaced 25% of its period. * - 9000: Displaced 25% of its period.
* - 18000: Displaced 50% of its period. * - 18000: Displaced 50% of its period.
@@ -530,33 +521,32 @@ typedef struct SDL_HapticConstant
* - 36000: Displaced 100% of its period, same as 0, but 0 is preferred. * - 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
* *
* Examples: * Examples:
* * \verbatim
* ``` SDL_HAPTIC_SINE
* SDL_HAPTIC_SINE __ __ __ __
* __ __ __ __ / \ / \ / \ /
* / \ / \ / \ / / \__/ \__/ \__/
* / \__/ \__/ \__/
* SDL_HAPTIC_SQUARE
* SDL_HAPTIC_SQUARE __ __ __ __ __
* __ __ __ __ __ | | | | | | | | | |
* | | | | | | | | | | | |__| |__| |__| |__| |
* | |__| |__| |__| |__| |
* SDL_HAPTIC_TRIANGLE
* SDL_HAPTIC_TRIANGLE /\ /\ /\ /\ /\
* /\ /\ /\ /\ /\ / \ / \ / \ / \ /
* / \ / \ / \ / \ / / \/ \/ \/ \/
* / \/ \/ \/ \/
* SDL_HAPTIC_SAWTOOTHUP
* SDL_HAPTIC_SAWTOOTHUP /| /| /| /| /| /| /|
* /| /| /| /| /| /| /| / | / | / | / | / | / | / |
* / | / | / | / | / | / | / | / |/ |/ |/ |/ |/ |/ |
* / |/ |/ |/ |/ |/ |/ |
* SDL_HAPTIC_SAWTOOTHDOWN
* SDL_HAPTIC_SAWTOOTHDOWN \ |\ |\ |\ |\ |\ |\ |
* \ |\ |\ |\ |\ |\ |\ | \ | \ | \ | \ | \ | \ | \ |
* \ | \ | \ | \ | \ | \ | \ | \| \| \| \| \| \| \|
* \| \| \| \| \| \| \| \endverbatim
* ```
* *
* \sa SDL_HAPTIC_SINE * \sa SDL_HAPTIC_SINE
* \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HAPTIC_LEFTRIGHT
@@ -568,9 +558,9 @@ typedef struct SDL_HapticConstant
typedef struct SDL_HapticPeriodic typedef struct SDL_HapticPeriodic
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_SINE, SDL_HAPTIC_LEFTRIGHT, Uint16 type; /**< ::SDL_HAPTIC_SINE, ::SDL_HAPTIC_LEFTRIGHT,
SDL_HAPTIC_TRIANGLE, SDL_HAPTIC_SAWTOOTHUP or ::SDL_HAPTIC_TRIANGLE, ::SDL_HAPTIC_SAWTOOTHUP or
SDL_HAPTIC_SAWTOOTHDOWN */ ::SDL_HAPTIC_SAWTOOTHDOWN */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
@@ -595,22 +585,21 @@ typedef struct SDL_HapticPeriodic
} SDL_HapticPeriodic; } SDL_HapticPeriodic;
/** /**
* A structure containing a template for a Condition effect. * \brief A structure containing a template for a Condition effect.
* *
* The struct handles the following effects: * The struct handles the following effects:
* * - ::SDL_HAPTIC_SPRING: Effect based on axes position.
* - SDL_HAPTIC_SPRING: Effect based on axes position. * - ::SDL_HAPTIC_DAMPER: Effect based on axes velocity.
* - SDL_HAPTIC_DAMPER: Effect based on axes velocity. * - ::SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
* - SDL_HAPTIC_INERTIA: Effect based on axes acceleration. * - ::SDL_HAPTIC_FRICTION: Effect based on axes movement.
* - SDL_HAPTIC_FRICTION: Effect based on axes movement.
* *
* Direction is handled by condition internals instead of a direction member. * Direction is handled by condition internals instead of a direction member.
* The condition effect specific members have three parameters. The first * The condition effect specific members have three parameters. The first
* refers to the X axis, the second refers to the Y axis and the third refers * refers to the X axis, the second refers to the Y axis and the third
* to the Z axis. The right terms refer to the positive side of the axis and * refers to the Z axis. The right terms refer to the positive side of the
* the left terms refer to the negative side of the axis. Please refer to the * axis and the left terms refer to the negative side of the axis. Please
* SDL_HapticDirection diagram for which side is positive and which is * refer to the ::SDL_HapticDirection diagram for which side is positive and
* negative. * which is negative.
* *
* \sa SDL_HapticDirection * \sa SDL_HapticDirection
* \sa SDL_HAPTIC_SPRING * \sa SDL_HAPTIC_SPRING
@@ -622,9 +611,9 @@ typedef struct SDL_HapticPeriodic
typedef struct SDL_HapticCondition typedef struct SDL_HapticCondition
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, Uint16 type; /**< ::SDL_HAPTIC_SPRING, ::SDL_HAPTIC_DAMPER,
SDL_HAPTIC_INERTIA or SDL_HAPTIC_FRICTION */ ::SDL_HAPTIC_INERTIA or ::SDL_HAPTIC_FRICTION */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect - Not used ATM. */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect. */ Uint32 length; /**< Duration of the effect. */
@@ -644,14 +633,14 @@ typedef struct SDL_HapticCondition
} SDL_HapticCondition; } SDL_HapticCondition;
/** /**
* A structure containing a template for a Ramp effect. * \brief A structure containing a template for a Ramp effect.
* *
* This struct is exclusively for the SDL_HAPTIC_RAMP effect. * This struct is exclusively for the ::SDL_HAPTIC_RAMP effect.
* *
* The ramp effect starts at start strength and ends at end strength. It * The ramp effect starts at start strength and ends at end strength.
* augments in linear fashion. If you use attack and fade with a ramp the * It augments in linear fashion. If you use attack and fade with a ramp
* effects get added to the ramp effect making the effect become quadratic * the effects get added to the ramp effect making the effect become
* instead of linear. * quadratic instead of linear.
* *
* \sa SDL_HAPTIC_RAMP * \sa SDL_HAPTIC_RAMP
* \sa SDL_HapticEffect * \sa SDL_HapticEffect
@@ -659,7 +648,7 @@ typedef struct SDL_HapticCondition
typedef struct SDL_HapticRamp typedef struct SDL_HapticRamp
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_RAMP */ Uint16 type; /**< ::SDL_HAPTIC_RAMP */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
@@ -682,9 +671,9 @@ typedef struct SDL_HapticRamp
} SDL_HapticRamp; } SDL_HapticRamp;
/** /**
* A structure containing a template for a Left/Right effect. * \brief A structure containing a template for a Left/Right effect.
* *
* This struct is exclusively for the SDL_HAPTIC_LEFTRIGHT effect. * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect.
* *
* The Left/Right effect is used to explicitly control the large and small * The Left/Right effect is used to explicitly control the large and small
* motors, commonly found in modern game controllers. The small (right) motor * motors, commonly found in modern game controllers. The small (right) motor
@@ -696,7 +685,7 @@ typedef struct SDL_HapticRamp
typedef struct SDL_HapticLeftRight typedef struct SDL_HapticLeftRight
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_LEFTRIGHT */ Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */
/* Replay */ /* Replay */
Uint32 length; /**< Duration of the effect in milliseconds. */ Uint32 length; /**< Duration of the effect in milliseconds. */
@@ -707,13 +696,13 @@ typedef struct SDL_HapticLeftRight
} SDL_HapticLeftRight; } SDL_HapticLeftRight;
/** /**
* A structure containing a template for the SDL_HAPTIC_CUSTOM effect. * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect.
* *
* This struct is exclusively for the SDL_HAPTIC_CUSTOM effect. * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect.
* *
* A custom force feedback effect is much like a periodic effect, where the * A custom force feedback effect is much like a periodic effect, where the
* application can define its exact shape. You will have to allocate the data * application can define its exact shape. You will have to allocate the
* yourself. Data should consist of channels * samples Uint16 samples. * data yourself. Data should consist of channels * samples Uint16 samples.
* *
* If channels is one, the effect is rotated using the defined direction. * If channels is one, the effect is rotated using the defined direction.
* Otherwise it uses the samples in data for the different axes. * Otherwise it uses the samples in data for the different axes.
@@ -724,7 +713,7 @@ typedef struct SDL_HapticLeftRight
typedef struct SDL_HapticCustom typedef struct SDL_HapticCustom
{ {
/* Header */ /* Header */
Uint16 type; /**< SDL_HAPTIC_CUSTOM */ Uint16 type; /**< ::SDL_HAPTIC_CUSTOM */
SDL_HapticDirection direction; /**< Direction of the effect. */ SDL_HapticDirection direction; /**< Direction of the effect. */
/* Replay */ /* Replay */
@@ -749,28 +738,27 @@ typedef struct SDL_HapticCustom
} SDL_HapticCustom; } SDL_HapticCustom;
/** /**
* The generic template for any haptic effect. * \brief The generic template for any haptic effect.
* *
* All values max at 32767 (0x7FFF). Signed values also can be negative. Time * All values max at 32767 (0x7FFF). Signed values also can be negative.
* values unless specified otherwise are in milliseconds. * Time values unless specified otherwise are in milliseconds.
* *
* You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. * You can also pass ::SDL_HAPTIC_INFINITY to length instead of a 0-32767
* Neither delay, interval, attack_length nor fade_length support * value. Neither delay, interval, attack_length nor fade_length support
* SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends. * ::SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
* *
* Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of * Additionally, the ::SDL_HAPTIC_RAMP effect does not support a duration of
* SDL_HAPTIC_INFINITY. * ::SDL_HAPTIC_INFINITY.
* *
* Button triggers may not be supported on all devices, it is advised to not * Button triggers may not be supported on all devices, it is advised to not
* use them if possible. Buttons start at index 1 instead of index 0 like the * use them if possible. Buttons start at index 1 instead of index 0 like
* joystick. * the joystick.
* *
* If both attack_length and fade_level are 0, the envelope is not used, * If both attack_length and fade_level are 0, the envelope is not used,
* otherwise both values are used. * otherwise both values are used.
* *
* Common parts: * Common parts:
* * \code
* ```c
* // Replay - All effects have this * // Replay - All effects have this
* Uint32 length; // Duration of effect (ms). * Uint32 length; // Duration of effect (ms).
* Uint16 delay; // Delay before starting effect. * Uint16 delay; // Delay before starting effect.
@@ -784,29 +772,29 @@ typedef struct SDL_HapticCustom
* Uint16 attack_level; // Level at the start of the attack. * Uint16 attack_level; // Level at the start of the attack.
* Uint16 fade_length; // Duration of the fade out (ms). * Uint16 fade_length; // Duration of the fade out (ms).
* Uint16 fade_level; // Level at the end of the fade. * Uint16 fade_level; // Level at the end of the fade.
* ``` * \endcode
*
* *
* Here we have an example of a constant effect evolution in time: * Here we have an example of a constant effect evolution in time:
* * \verbatim
* ``` Strength
* Strength ^
* ^ |
* | | effect level --> _________________
* | effect level --> _________________ | / \
* | / \ | / \
* | / \ | / \
* | / \ | / \
* | / \ | attack_level --> | \
* | attack_level --> | \ | | | <--- fade_level
* | | | <--- fade_level |
* | +--------------------------------------------------> Time
* +--------------------------------------------------> Time [--] [---]
* [--] [---] attack_length fade_length
* attack_length fade_length
* [------------------][-----------------------]
* [------------------][-----------------------] delay length
* delay length \endverbatim
* ```
* *
* Note either the attack_level or the fade_level may be above the actual * Note either the attack_level or the fade_level may be above the actual
* effect level. * effect level.
@@ -871,7 +859,7 @@ extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index);
* autocenter will be disabled. To modify these values use SDL_HapticSetGain() * autocenter will be disabled. To modify these values use SDL_HapticSetGain()
* and SDL_HapticSetAutocenter(). * and SDL_HapticSetAutocenter().
* *
* \param device_index index of the device to open. * \param device_index index of the device to open
* \returns the device identifier or NULL on failure; call SDL_GetError() for * \returns the device identifier or NULL on failure; call SDL_GetError() for
* more information. * more information.
* *
@@ -891,7 +879,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpen(int device_index);
/** /**
* Check if the haptic device at the designated index has been opened. * Check if the haptic device at the designated index has been opened.
* *
* \param device_index the index of the device to query. * \param device_index the index of the device to query
* \returns 1 if it has been opened, 0 if it hasn't or on failure; call * \returns 1 if it has been opened, 0 if it hasn't or on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -905,7 +893,7 @@ extern DECLSPEC int SDLCALL SDL_HapticOpened(int device_index);
/** /**
* Get the index of a haptic device. * Get the index of a haptic device.
* *
* \param haptic the SDL_Haptic device to query. * \param haptic the SDL_Haptic device to query
* \returns the index of the specified haptic device or a negative error code * \returns the index of the specified haptic device or a negative error code
* on failure; call SDL_GetError() for more information. * on failure; call SDL_GetError() for more information.
* *
@@ -943,7 +931,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void);
/** /**
* Query if a joystick has haptic features. * Query if a joystick has haptic features.
* *
* \param joystick the SDL_Joystick to test for haptic capabilities. * \param joystick the SDL_Joystick to test for haptic capabilities
* \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a * \returns SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't, or a
* negative error code on failure; call SDL_GetError() for more * negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -965,7 +953,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick);
* device will also get unallocated and you'll be unable to use force feedback * device will also get unallocated and you'll be unable to use force feedback
* on that device. * on that device.
* *
* \param joystick the SDL_Joystick to create a haptic device from. * \param joystick the SDL_Joystick to create a haptic device from
* \returns a valid haptic device identifier on success or NULL on failure; * \returns a valid haptic device identifier on success or NULL on failure;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -981,7 +969,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick *
/** /**
* Close a haptic device previously opened with SDL_HapticOpen(). * Close a haptic device previously opened with SDL_HapticOpen().
* *
* \param haptic the SDL_Haptic device to close. * \param haptic the SDL_Haptic device to close
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -996,7 +984,7 @@ extern DECLSPEC void SDLCALL SDL_HapticClose(SDL_Haptic * haptic);
* approximation. Always check to see if your created effect was actually * approximation. Always check to see if your created effect was actually
* created and do not rely solely on SDL_HapticNumEffects(). * created and do not rely solely on SDL_HapticNumEffects().
* *
* \param haptic the SDL_Haptic device to query. * \param haptic the SDL_Haptic device to query
* \returns the number of effects the haptic device can store or a negative * \returns the number of effects the haptic device can store or a negative
* error code on failure; call SDL_GetError() for more information. * error code on failure; call SDL_GetError() for more information.
* *
@@ -1012,7 +1000,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffects(SDL_Haptic * haptic);
* *
* This is not supported on all platforms, but will always return a value. * This is not supported on all platforms, but will always return a value.
* *
* \param haptic the SDL_Haptic device to query maximum playing effects. * \param haptic the SDL_Haptic device to query maximum playing effects
* \returns the number of effects the haptic device can play at the same time * \returns the number of effects the haptic device can play at the same time
* or a negative error code on failure; call SDL_GetError() for more * or a negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -1027,7 +1015,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic);
/** /**
* Get the haptic device's supported features in bitwise manner. * Get the haptic device's supported features in bitwise manner.
* *
* \param haptic the SDL_Haptic device to query. * \param haptic the SDL_Haptic device to query
* \returns a list of supported haptic features in bitwise manner (OR'd), or 0 * \returns a list of supported haptic features in bitwise manner (OR'd), or 0
* on failure; call SDL_GetError() for more information. * on failure; call SDL_GetError() for more information.
* *
@@ -1045,7 +1033,7 @@ extern DECLSPEC unsigned int SDLCALL SDL_HapticQuery(SDL_Haptic * haptic);
* The number of haptic axes might be useful if working with the * The number of haptic axes might be useful if working with the
* SDL_HapticDirection effect. * SDL_HapticDirection effect.
* *
* \param haptic the SDL_Haptic device to query. * \param haptic the SDL_Haptic device to query
* \returns the number of axes on success or a negative error code on failure; * \returns the number of axes on success or a negative error code on failure;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -1056,8 +1044,8 @@ extern DECLSPEC int SDLCALL SDL_HapticNumAxes(SDL_Haptic * haptic);
/** /**
* Check to see if an effect is supported by a haptic device. * Check to see if an effect is supported by a haptic device.
* *
* \param haptic the SDL_Haptic device to query. * \param haptic the SDL_Haptic device to query
* \param effect the desired effect to query. * \param effect the desired effect to query
* \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a
* negative error code on failure; call SDL_GetError() for more * negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -1074,9 +1062,9 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic,
/** /**
* Create a new haptic effect on a specified device. * Create a new haptic effect on a specified device.
* *
* \param haptic an SDL_Haptic device to create the effect on. * \param haptic an SDL_Haptic device to create the effect on
* \param effect an SDL_HapticEffect structure containing the properties of * \param effect an SDL_HapticEffect structure containing the properties of
* the effect to create. * the effect to create
* \returns the ID of the effect on success or a negative error code on * \returns the ID of the effect on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -1097,10 +1085,10 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic,
* start playing from the start. You also cannot change the type either when * start playing from the start. You also cannot change the type either when
* running SDL_HapticUpdateEffect(). * running SDL_HapticUpdateEffect().
* *
* \param haptic the SDL_Haptic device that has the effect. * \param haptic the SDL_Haptic device that has the effect
* \param effect the identifier of the effect to update. * \param effect the identifier of the effect to update
* \param data an SDL_HapticEffect structure containing the new effect * \param data an SDL_HapticEffect structure containing the new effect
* properties to use. * properties to use
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1123,10 +1111,10 @@ extern DECLSPEC int SDLCALL SDL_HapticUpdateEffect(SDL_Haptic * haptic,
* set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY` * set the effect's `length` in its structure/union to `SDL_HAPTIC_INFINITY`
* instead. * instead.
* *
* \param haptic the SDL_Haptic device to run the effect on. * \param haptic the SDL_Haptic device to run the effect on
* \param effect the ID of the haptic effect to run. * \param effect the ID of the haptic effect to run
* \param iterations the number of iterations to run the effect; use * \param iterations the number of iterations to run the effect; use
* `SDL_HAPTIC_INFINITY` to repeat forever. * `SDL_HAPTIC_INFINITY` to repeat forever
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1145,8 +1133,8 @@ extern DECLSPEC int SDLCALL SDL_HapticRunEffect(SDL_Haptic * haptic,
* *
* * * *
* *
* \param haptic the SDL_Haptic device to stop the effect on. * \param haptic the SDL_Haptic device to stop the effect on
* \param effect the ID of the haptic effect to stop. * \param effect the ID of the haptic effect to stop
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1164,8 +1152,8 @@ extern DECLSPEC int SDLCALL SDL_HapticStopEffect(SDL_Haptic * haptic,
* This will stop the effect if it's running. Effects are automatically * This will stop the effect if it's running. Effects are automatically
* destroyed when the device is closed. * destroyed when the device is closed.
* *
* \param haptic the SDL_Haptic device to destroy the effect on. * \param haptic the SDL_Haptic device to destroy the effect on
* \param effect the ID of the haptic effect to destroy. * \param effect the ID of the haptic effect to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1179,8 +1167,8 @@ extern DECLSPEC void SDLCALL SDL_HapticDestroyEffect(SDL_Haptic * haptic,
* *
* Device must support the SDL_HAPTIC_STATUS feature. * Device must support the SDL_HAPTIC_STATUS feature.
* *
* \param haptic the SDL_Haptic device to query for the effect status on. * \param haptic the SDL_Haptic device to query for the effect status on
* \param effect the ID of the haptic effect to query its status. * \param effect the ID of the haptic effect to query its status
* \returns 0 if it isn't playing, 1 if it is playing, or a negative error * \returns 0 if it isn't playing, 1 if it is playing, or a negative error
* code on failure; call SDL_GetError() for more information. * code on failure; call SDL_GetError() for more information.
* *
@@ -1202,9 +1190,8 @@ extern DECLSPEC int SDLCALL SDL_HapticGetEffectStatus(SDL_Haptic * haptic,
* SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the * SDL_HapticSetGain() will scale linearly using `SDL_HAPTIC_GAIN_MAX` as the
* maximum. * maximum.
* *
* \param haptic the SDL_Haptic device to set the gain on. * \param haptic the SDL_Haptic device to set the gain on
* \param gain value to set the gain to, should be between 0 and 100 (0 - * \param gain value to set the gain to, should be between 0 and 100 (0 - 100)
* 100).
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1222,8 +1209,8 @@ extern DECLSPEC int SDLCALL SDL_HapticSetGain(SDL_Haptic * haptic, int gain);
* *
* Device must support the SDL_HAPTIC_AUTOCENTER feature. * Device must support the SDL_HAPTIC_AUTOCENTER feature.
* *
* \param haptic the SDL_Haptic device to set autocentering on. * \param haptic the SDL_Haptic device to set autocentering on
* \param autocenter value to set autocenter to (0-100). * \param autocenter value to set autocenter to (0-100)
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1243,7 +1230,7 @@ extern DECLSPEC int SDLCALL SDL_HapticSetAutocenter(SDL_Haptic * haptic,
* Do not modify the effects nor add new ones while the device is paused. That * Do not modify the effects nor add new ones while the device is paused. That
* can cause all sorts of weird errors. * can cause all sorts of weird errors.
* *
* \param haptic the SDL_Haptic device to pause. * \param haptic the SDL_Haptic device to pause
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1258,7 +1245,7 @@ extern DECLSPEC int SDLCALL SDL_HapticPause(SDL_Haptic * haptic);
* *
* Call to unpause after SDL_HapticPause(). * Call to unpause after SDL_HapticPause().
* *
* \param haptic the SDL_Haptic device to unpause. * \param haptic the SDL_Haptic device to unpause
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1271,7 +1258,7 @@ extern DECLSPEC int SDLCALL SDL_HapticUnpause(SDL_Haptic * haptic);
/** /**
* Stop all the currently playing effects on a haptic device. * Stop all the currently playing effects on a haptic device.
* *
* \param haptic the SDL_Haptic device to stop. * \param haptic the SDL_Haptic device to stop
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1282,7 +1269,7 @@ extern DECLSPEC int SDLCALL SDL_HapticStopAll(SDL_Haptic * haptic);
/** /**
* Check whether rumble is supported on a haptic device. * Check whether rumble is supported on a haptic device.
* *
* \param haptic haptic device to check for rumble support. * \param haptic haptic device to check for rumble support
* \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a * \returns SDL_TRUE if effect is supported, SDL_FALSE if it isn't, or a
* negative error code on failure; call SDL_GetError() for more * negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -1298,7 +1285,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleSupported(SDL_Haptic * haptic);
/** /**
* Initialize a haptic device for simple rumble playback. * Initialize a haptic device for simple rumble playback.
* *
* \param haptic the haptic device to initialize for simple rumble playback. * \param haptic the haptic device to initialize for simple rumble playback
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1314,9 +1301,9 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleInit(SDL_Haptic * haptic);
/** /**
* Run a simple rumble effect on a haptic device. * Run a simple rumble effect on a haptic device.
* *
* \param haptic the haptic device to play the rumble effect on. * \param haptic the haptic device to play the rumble effect on
* \param strength strength of the rumble to play as a 0-1 float value. * \param strength strength of the rumble to play as a 0-1 float value
* \param length length of the rumble to play in milliseconds. * \param length length of the rumble to play in milliseconds
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1331,7 +1318,7 @@ extern DECLSPEC int SDLCALL SDL_HapticRumblePlay(SDL_Haptic * haptic, float stre
/** /**
* Stop the simple rumble on a haptic device. * Stop the simple rumble on a haptic device.
* *
* \param haptic the haptic device to stop the rumble effect on. * \param haptic the haptic device to stop the rumble effect on
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,35 +19,44 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: HIDAPI */
/** /**
* # CategoryHIDAPI * \file SDL_hidapi.h
* *
* Header file for SDL HIDAPI functions. * Header file for SDL HIDAPI functions.
* *
* This is an adaptation of the original HIDAPI interface by Alan Ott, and * This is an adaptation of the original HIDAPI interface by Alan Ott,
* includes source code licensed under the following license: * and includes source code licensed under the following BSD license:
* *
* ``` Copyright (c) 2010, Alan Ott, Signal 11 Software
* HIDAPI - Multi-Platform library for All rights reserved.
* communication with HID devices.
* Redistribution and use in source and binary forms, with or without
* Copyright 2009, Alan Ott, Signal 11 Software. modification, are permitted provided that the following conditions are met:
* All Rights Reserved.
* * Redistributions of source code must retain the above copyright notice,
* This software may be used by anyone for any reason so this list of conditions and the following disclaimer.
* long as the copyright notice in the source files * Redistributions in binary form must reproduce the above copyright
* remains intact. notice, this list of conditions and the following disclaimer in the
* ``` documentation and/or other materials provided with the distribution.
* * Neither the name of Signal 11 Software nor the names of its
* (Note that this license is the same as item three of SDL's zlib license, so contributors may be used to endorse or promote products derived from
* it adds no new requirements on the user.) this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
* *
* If you would like a version of SDL without this code, you can build SDL * If you would like a version of SDL without this code, you can build SDL
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
* example on iOS or tvOS to avoid a dependency on the CoreBluetooth * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
* framework.
*/ */
#ifndef SDL_hidapi_h_ #ifndef SDL_hidapi_h_
@@ -62,15 +71,14 @@ extern "C" {
#endif #endif
/** /**
* A handle representing an open HID device * \brief A handle representing an open HID device
*/ */
struct SDL_hid_device_; struct SDL_hid_device_;
typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */ typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
/** hidapi info structure */ /** hidapi info structure */
/** /**
* Information about a connected HID device * \brief Information about a connected HID device
*/ */
typedef struct SDL_hid_device_info typedef struct SDL_hid_device_info
{ {
@@ -226,13 +234,13 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id,
* The path name be determined by calling SDL_hid_enumerate(), or a * The path name be determined by calling SDL_hid_enumerate(), or a
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux). * platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
* *
* \param path The path name of the device to open. * \param path The path name of the device to open
* \returns a pointer to a SDL_hid_device object on success or NULL on * \returns a pointer to a SDL_hid_device object on success or NULL on
* failure. * failure.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive); extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
/** /**
* Write an Output report to a HID device. * Write an Output report to a HID device.
@@ -426,7 +434,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int
/** /**
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
* *
* \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan. * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,26 +20,22 @@
*/ */
/** /**
* # CategoryJoystick * \file SDL_joystick.h
* *
* Include file for SDL joystick event handling * Include file for SDL joystick event handling
* *
* The term "device_index" identifies currently plugged in joystick devices * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
* between 0 and SDL_NumJoysticks(), with the exact joystick behind a * behind a device_index changing as joysticks are plugged and unplugged.
* device_index changing as joysticks are plugged and unplugged.
* *
* The term "instance_id" is the current instantiation of a joystick device in * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
* the system, if the joystick is removed and then re-inserted then it will * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
* get a new instance_id, instance_id's are monotonically increasing
* identifiers of a joystick plugged in.
* *
* The term "player_index" is the number assigned to a player on a specific * The term "player_index" is the number assigned to a player on a specific
* controller. For XInput controllers this returns the XInput user index. Many * controller. For XInput controllers this returns the XInput user index.
* joysticks will not be able to supply this information. * Many joysticks will not be able to supply this information.
* *
* The term JoystickGUID is a stable 128-bit identifier for a joystick device * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
* that does not change over time, it identifies class of the device (a X360 * the device (a X360 wired controller for example). This identifier is platform dependent.
* wired controller for example). This identifier is platform dependent.
*/ */
#ifndef SDL_joystick_h_ #ifndef SDL_joystick_h_
@@ -60,7 +56,7 @@ extern "C" {
* \file SDL_joystick.h * \file SDL_joystick.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
* for joysticks, and load appropriate drivers. * for joysticks, and load appropriate drivers.
* *
* If you would like to receive joystick updates while the application * If you would like to receive joystick updates while the application
@@ -77,21 +73,15 @@ extern SDL_mutex *SDL_joystick_lock;
struct _SDL_Joystick; struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick;
/** /* A structure that encodes the stable unique id for a joystick device */
* A structure that encodes the stable unique id for a joystick device.
*
* This is just a standard SDL_GUID by a different name.
*/
typedef SDL_GUID SDL_JoystickGUID; typedef SDL_GUID SDL_JoystickGUID;
/** /**
* This is a unique ID for a joystick for the time it is connected to the * This is a unique ID for a joystick for the time it is connected to the system,
* system, and is never reused for the lifetime of the application. * and is never reused for the lifetime of the application. If the joystick is
* disconnected and reconnected, it will get a new ID.
* *
* If the joystick is disconnected and reconnected, it will get a new ID. * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
*
* The ID value starts at 0 and increments from there. The value -1 is an
* invalid ID.
*/ */
typedef Sint32 SDL_JoystickID; typedef Sint32 SDL_JoystickID;
@@ -182,7 +172,7 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system). * on the system)
* \returns the name of the selected joystick. If no name can be found, this * \returns the name of the selected joystick. If no name can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -199,7 +189,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system). * on the system)
* \returns the path of the selected joystick. If no path can be found, this * \returns the path of the selected joystick. If no path can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -225,9 +215,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
* This function can be called before any joysticks are opened. * This function can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the GUID of the selected joystick. If called on an invalid index, * \returns the GUID of the selected joystick. If called on an invalid index,
* this function returns a zero GUID. * this function returns a zero GUID
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -243,9 +233,9 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_in
* available this function returns 0. * available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the USB vendor ID of the selected joystick. If called on an * \returns the USB vendor ID of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -258,9 +248,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
* available this function returns 0. * available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the USB product ID of the selected joystick. If called on an * \returns the USB product ID of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -273,9 +263,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
* isn't available this function returns 0. * isn't available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the product version of the selected joystick. If called on an * \returns the product version of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -287,9 +277,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_in
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the SDL_JoystickType of the selected joystick. If called on an * \returns the SDL_JoystickType of the selected joystick. If called on an
* invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`. * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -301,7 +291,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the instance id of the selected joystick. If called on an invalid * \returns the instance id of the selected joystick. If called on an invalid
* index, this function returns -1. * index, this function returns -1.
* *
@@ -320,7 +310,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int devic
* The joystick subsystem must be initialized before a joystick can be opened * The joystick subsystem must be initialized before a joystick can be opened
* for use. * for use.
* *
* \param device_index the index of the joystick to query. * \param device_index the index of the joystick to query
* \returns a joystick identifier or NULL if an error occurred; call * \returns a joystick identifier or NULL if an error occurred; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -334,7 +324,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/** /**
* Get the SDL_Joystick associated with an instance id. * Get the SDL_Joystick associated with an instance id.
* *
* \param instance_id the instance id to get the SDL_Joystick for. * \param instance_id the instance id to get the SDL_Joystick for
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -345,7 +335,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID
/** /**
* Get the SDL_Joystick associated with a player index. * Get the SDL_Joystick associated with a player index.
* *
* \param player_index the player index to get the SDL_Joystick for. * \param player_index the player index to get the SDL_Joystick for
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -368,10 +358,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
/** /**
* The structure that defines an extended virtual joystick description * The structure that defines an extended virtual joystick description
* *
* The caller must zero the structure and then initialize the version with * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
* `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to * All other elements of this structure are optional and can be left 0.
* SDL_JoystickAttachVirtualEx() All other elements of this structure are
* optional and can be left 0.
* *
* \sa SDL_JoystickAttachVirtualEx * \sa SDL_JoystickAttachVirtualEx
*/ */
@@ -402,7 +390,7 @@ typedef struct SDL_VirtualJoystickDesc
} SDL_VirtualJoystickDesc; } SDL_VirtualJoystickDesc;
/** /**
* The current version of the SDL_VirtualJoystickDesc structure * \brief The current version of the SDL_VirtualJoystickDesc structure
*/ */
#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 #define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1
@@ -419,7 +407,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystic
* Detach a virtual joystick. * Detach a virtual joystick.
* *
* \param device_index a value previously returned from * \param device_index a value previously returned from
* SDL_JoystickAttachVirtual(). * SDL_JoystickAttachVirtual()
* \returns 0 on success, or -1 if an error occurred. * \returns 0 on success, or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -497,7 +485,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in
/** /**
* Get the implementation dependent name of a joystick. * Get the implementation dependent name of a joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the name of the selected joystick. If no name can be found, this * \returns the name of the selected joystick. If no name can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -511,7 +499,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
/** /**
* Get the implementation dependent path of a joystick. * Get the implementation dependent path of a joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the path of the selected joystick. If no path can be found, this * \returns the path of the selected joystick. If no path can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -527,7 +515,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick);
* For XInput controllers this returns the XInput user index. Many joysticks * For XInput controllers this returns the XInput user index. Many joysticks
* will not be able to supply this information. * will not be able to supply this information.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the player index, or -1 if it's not available. * \returns the player index, or -1 if it's not available.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -537,7 +525,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
/** /**
* Set the player index of an opened joystick. * Set the player index of an opened joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \param player_index Player index to assign to this joystick, or -1 to clear * \param player_index Player index to assign to this joystick, or -1 to clear
* the player index and turn off player LEDs. * the player index and turn off player LEDs.
* *
@@ -550,7 +538,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick,
* *
* This function requires an open joystick. * This function requires an open joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the GUID of the given joystick. If called on an invalid index, * \returns the GUID of the given joystick. If called on an invalid index,
* this function returns a zero GUID; call SDL_GetError() for more * this function returns a zero GUID; call SDL_GetError() for more
* information. * information.
@@ -567,7 +555,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joyst
* *
* If the vendor ID isn't available this function returns 0. * If the vendor ID isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the USB vendor ID of the selected joystick, or 0 if unavailable. * \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -579,7 +567,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
* *
* If the product ID isn't available this function returns 0. * If the product ID isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the USB product ID of the selected joystick, or 0 if unavailable. * \returns the USB product ID of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -591,7 +579,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
* *
* If the product version isn't available this function returns 0. * If the product version isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the product version of the selected joystick, or 0 if unavailable. * \returns the product version of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -603,7 +591,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joyst
* *
* If the firmware version isn't available this function returns 0. * If the firmware version isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the firmware version of the selected joystick, or 0 if * \returns the firmware version of the selected joystick, or 0 if
* unavailable. * unavailable.
* *
@@ -616,7 +604,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joys
* *
* Returns the serial number of the joystick, or NULL if it is not available. * Returns the serial number of the joystick, or NULL if it is not available.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the serial number of the selected joystick, or NULL if * \returns the serial number of the selected joystick, or NULL if
* unavailable. * unavailable.
* *
@@ -627,7 +615,7 @@ extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystic
/** /**
* Get the type of an opened joystick. * Get the type of an opened joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the SDL_JoystickType of the selected joystick. * \returns the SDL_JoystickType of the selected joystick.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -639,9 +627,9 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joyst
* *
* You should supply at least 33 bytes for pszGUID. * You should supply at least 33 bytes for pszGUID.
* *
* \param guid the SDL_JoystickGUID you wish to convert to string. * \param guid the SDL_JoystickGUID you wish to convert to string
* \param pszGUID buffer in which to write the ASCII string. * \param pszGUID buffer in which to write the ASCII string
* \param cbGUID the size of pszGUID. * \param cbGUID the size of pszGUID
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -658,7 +646,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch
* an invalid GUID, the function will silently succeed, but the GUID generated * an invalid GUID, the function will silently succeed, but the GUID generated
* will not be useful. * will not be useful.
* *
* \param pchGUID string containing an ASCII representation of a GUID. * \param pchGUID string containing an ASCII representation of a GUID
* \returns a SDL_JoystickGUID structure. * \returns a SDL_JoystickGUID structure.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -670,15 +658,15 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
/** /**
* Get the device information encoded in a SDL_JoystickGUID structure * Get the device information encoded in a SDL_JoystickGUID structure
* *
* \param guid the SDL_JoystickGUID you wish to get info about. * \param guid the SDL_JoystickGUID you wish to get info about
* \param vendor A pointer filled in with the device VID, or 0 if not * \param vendor A pointer filled in with the device VID, or 0 if not
* available. * available
* \param product A pointer filled in with the device PID, or 0 if not * \param product A pointer filled in with the device PID, or 0 if not
* available. * available
* \param version A pointer filled in with the device version, or 0 if not * \param version A pointer filled in with the device version, or 0 if not
* available. * available
* \param crc16 A pointer filled in with a CRC used to distinguish different * \param crc16 A pointer filled in with a CRC used to distinguish different
* products with the same VID/PID, or 0 if not available. * products with the same VID/PID, or 0 if not available
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
* *
@@ -689,7 +677,7 @@ extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint
/** /**
* Get the status of a specified joystick. * Get the status of a specified joystick.
* *
* \param joystick the joystick to query. * \param joystick the joystick to query
* \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -703,7 +691,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick)
/** /**
* Get the instance ID of an opened joystick. * Get the instance ID of an opened joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the instance ID of the specified joystick on success or a negative * \returns the instance ID of the specified joystick on success or a negative
* error code on failure; call SDL_GetError() for more information. * error code on failure; call SDL_GetError() for more information.
* *
@@ -720,7 +708,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joys
* separate buttons or a POV hat, and not axes, but all of this is up to the * separate buttons or a POV hat, and not axes, but all of this is up to the
* device and platform. * device and platform.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of axis controls/number of axes on success or a * \returns the number of axis controls/number of axes on success or a
* negative error code on failure; call SDL_GetError() for more * negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -740,7 +728,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
* *
* Most joysticks do not have trackballs. * Most joysticks do not have trackballs.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of trackballs on success or a negative error code on * \returns the number of trackballs on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -753,7 +741,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
/** /**
* Get the number of POV hats on a joystick. * Get the number of POV hats on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of POV hats on success or a negative error code on * \returns the number of POV hats on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -767,7 +755,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
/** /**
* Get the number of buttons on a joystick. * Get the number of buttons on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of buttons on success or a negative error code on * \returns the number of buttons on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -806,10 +794,10 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
* `SDL_ENABLE`, this function accepts any value, with any non-zero value that * `SDL_ENABLE`, this function accepts any value, with any non-zero value that
* isn't `SDL_QUERY` being treated as `SDL_ENABLE`. * isn't `SDL_QUERY` being treated as `SDL_ENABLE`.
* *
* If SDL was built with events disabled (extremely uncommon!), this will do * If SDL was built with events disabled (extremely uncommon!), this will
* nothing and always return `SDL_IGNORE`. * do nothing and always return `SDL_IGNORE`.
* *
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`. * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
* \returns If `state` is `SDL_QUERY` then the current state is returned, * \returns If `state` is `SDL_QUERY` then the current state is returned,
* otherwise `state` is returned (even if it was not one of the * otherwise `state` is returned (even if it was not one of the
* allowed values). * allowed values).
@@ -820,7 +808,6 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
/* Limits for joystick axes... */
#define SDL_JOYSTICK_AXIS_MAX 32767 #define SDL_JOYSTICK_AXIS_MAX 32767
#define SDL_JOYSTICK_AXIS_MIN -32768 #define SDL_JOYSTICK_AXIS_MIN -32768
@@ -837,8 +824,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
* 32767) representing the current position of the axis. It may be necessary * 32767) representing the current position of the axis. It may be necessary
* to impose certain tolerances on these values to account for jitter. * to impose certain tolerances on these values to account for jitter.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param axis the axis to query; the axis indices start at index 0. * \param axis the axis to query; the axis indices start at index 0
* \returns a 16-bit signed integer representing the current position of the * \returns a 16-bit signed integer representing the current position of the
* axis or 0 on failure; call SDL_GetError() for more information. * axis or 0 on failure; call SDL_GetError() for more information.
* *
@@ -856,8 +843,8 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
* *
* The axis indices start at index 0. * The axis indices start at index 0.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param axis the axis to query; the axis indices start at index 0. * \param axis the axis to query; the axis indices start at index 0
* \param state Upon return, the initial value is supplied here. * \param state Upon return, the initial value is supplied here.
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
* *
@@ -896,8 +883,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *j
* - `SDL_HAT_LEFTUP` * - `SDL_HAT_LEFTUP`
* - `SDL_HAT_LEFTDOWN` * - `SDL_HAT_LEFTDOWN`
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param hat the hat index to get the state from; indices start at index 0. * \param hat the hat index to get the state from; indices start at index 0
* \returns the current hat position. * \returns the current hat position.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -915,10 +902,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
* *
* Most joysticks do not have trackballs. * Most joysticks do not have trackballs.
* *
* \param joystick the SDL_Joystick to query. * \param joystick the SDL_Joystick to query
* \param ball the ball index to query; ball indices start at index 0. * \param ball the ball index to query; ball indices start at index 0
* \param dx stores the difference in the x axis position since the last poll. * \param dx stores the difference in the x axis position since the last poll
* \param dy stores the difference in the y axis position since the last poll. * \param dy stores the difference in the y axis position since the last poll
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -932,9 +919,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
/** /**
* Get the current state of a button on a joystick. * Get the current state of a button on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param button the button index to get the state from; indices start at * \param button the button index to get the state from; indices start at
* index 0. * index 0
* \returns 1 if the specified button is pressed, 0 otherwise. * \returns 1 if the specified button is pressed, 0 otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -950,13 +937,13 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
* Each call to this function cancels any previous rumble effect, and calling * Each call to this function cancels any previous rumble effect, and calling
* it with 0 intensity stops any rumbling. * it with 0 intensity stops any rumbling.
* *
* \param joystick The joystick to vibrate. * \param joystick The joystick to vibrate
* \param low_frequency_rumble The intensity of the low frequency (left) * \param low_frequency_rumble The intensity of the low frequency (left)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param high_frequency_rumble The intensity of the high frequency (right) * \param high_frequency_rumble The intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if rumble isn't supported on this joystick. * \returns 0, or -1 if rumble isn't supported on this joystick
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
* *
@@ -975,13 +962,13 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
* want the (more common) whole-controller rumble, use SDL_JoystickRumble() * want the (more common) whole-controller rumble, use SDL_JoystickRumble()
* instead. * instead.
* *
* \param joystick The joystick to vibrate. * \param joystick The joystick to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0 * \param left_rumble The intensity of the left trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param right_rumble The intensity of the right trigger rumble motor, from 0 * \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this joystick. * \returns 0, or -1 if trigger rumble isn't supported on this joystick
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *
@@ -995,7 +982,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, U
* An example of a joystick LED is the light on the back of a PlayStation 4's * An example of a joystick LED is the light on the back of a PlayStation 4's
* DualShock 4 controller. * DualShock 4 controller.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -1005,7 +992,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
/** /**
* Query whether a joystick has rumble support. * Query whether a joystick has rumble support.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
@@ -1017,7 +1004,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick);
/** /**
* Query whether a joystick has rumble support on triggers. * Query whether a joystick has rumble support on triggers.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
@@ -1032,11 +1019,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joy
* An example of a joystick LED is the light on the back of a PlayStation 4's * An example of a joystick LED is the light on the back of a PlayStation 4's
* DualShock 4 controller. * DualShock 4 controller.
* *
* \param joystick The joystick to update. * \param joystick The joystick to update
* \param red The intensity of the red LED. * \param red The intensity of the red LED
* \param green The intensity of the green LED. * \param green The intensity of the green LED
* \param blue The intensity of the blue LED. * \param blue The intensity of the blue LED
* \returns 0 on success, -1 if this joystick does not have a modifiable LED. * \returns 0 on success, -1 if this joystick does not have a modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1045,11 +1032,10 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red
/** /**
* Send a joystick specific effect packet * Send a joystick specific effect packet
* *
* \param joystick The joystick to affect. * \param joystick The joystick to affect
* \param data The data to send to the joystick. * \param data The data to send to the joystick
* \param size The size of the data to send to the joystick. * \param size The size of the data to send to the joystick
* \returns 0, or -1 if this joystick or driver doesn't support effect * \returns 0, or -1 if this joystick or driver doesn't support effect packets
* packets.
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
@@ -1058,7 +1044,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const
/** /**
* Close a joystick previously opened with SDL_JoystickOpen(). * Close a joystick previously opened with SDL_JoystickOpen().
* *
* \param joystick The joystick device to close. * \param joystick The joystick device to close
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1069,9 +1055,9 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
/** /**
* Get the battery level of a joystick as SDL_JoystickPowerLevel. * Get the battery level of a joystick as SDL_JoystickPowerLevel.
* *
* \param joystick the SDL_Joystick to query. * \param joystick the SDL_Joystick to query
* \returns the current battery level as SDL_JoystickPowerLevel on success or * \returns the current battery level as SDL_JoystickPowerLevel on success or
* `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown. * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
*/ */

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryKeyboard * \file SDL_keyboard.h
* *
* Include file for SDL keyboard event handling * Include file for SDL keyboard event handling
*/ */
@@ -40,16 +40,15 @@ extern "C" {
#endif #endif
/** /**
* The SDL keysym structure, used in key events. * \brief The SDL keysym structure, used in key events.
* *
* If you are looking for translated character input, see the SDL_TEXTINPUT * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
* event.
*/ */
typedef struct SDL_Keysym typedef struct SDL_Keysym
{ {
SDL_Scancode scancode; /**< SDL physical key code - see SDL_Scancode for details */ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
SDL_Keycode sym; /**< SDL virtual key code - see SDL_Keycode for details */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Uint16 mod; /**< current key modifiers - see SDL_Keymod for details */ Uint16 mod; /**< current key modifiers */
Uint32 unused; Uint32 unused;
} SDL_Keysym; } SDL_Keysym;
@@ -85,7 +84,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
* Note: This function doesn't take into account whether shift has been * Note: This function doesn't take into account whether shift has been
* pressed or not. * pressed or not.
* *
* \param numkeys if non-NULL, receives the length of the returned array. * \param numkeys if non-NULL, receives the length of the returned array
* \returns a pointer to an array of key states. * \returns a pointer to an array of key states.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -130,7 +129,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
* This does not change the keyboard state, only the key modifier flags that * This does not change the keyboard state, only the key modifier flags that
* SDL reports. * SDL reports.
* *
* \param modstate the desired SDL_Keymod for the keyboard. * \param modstate the desired SDL_Keymod for the keyboard
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -144,7 +143,7 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
* *
* See SDL_Keycode for details. * See SDL_Keycode for details.
* *
* \param scancode the desired SDL_Scancode to query. * \param scancode the desired SDL_Scancode to query
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -160,7 +159,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode
* *
* See SDL_Scancode for details. * See SDL_Scancode for details.
* *
* \param key the desired SDL_Keycode to query. * \param key the desired SDL_Keycode to query
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode. * \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -184,7 +183,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
* unsuitable for creating a stable cross-platform two-way mapping between * unsuitable for creating a stable cross-platform two-way mapping between
* strings and scancodes. * strings and scancodes.
* *
* \param scancode the desired SDL_Scancode to query. * \param scancode the desired SDL_Scancode to query
* \returns a pointer to the name for the scancode. If the scancode doesn't * \returns a pointer to the name for the scancode. If the scancode doesn't
* have a name this function returns an empty string (""). * have a name this function returns an empty string ("").
* *
@@ -198,7 +197,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
/** /**
* Get a scancode from a human-readable name. * Get a scancode from a human-readable name.
* *
* \param name the human-readable scancode name. * \param name the human-readable scancode name
* \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't
* recognized; call SDL_GetError() for more information. * recognized; call SDL_GetError() for more information.
* *
@@ -215,7 +214,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
* *
* See SDL_Scancode and SDL_Keycode for details. * See SDL_Scancode and SDL_Keycode for details.
* *
* \param key the desired SDL_Keycode to query. * \param key the desired SDL_Keycode to query
* \returns a pointer to a UTF-8 string that stays valid at least until the * \returns a pointer to a UTF-8 string that stays valid at least until the
* next call to this function. If you need it around any longer, you * next call to this function. If you need it around any longer, you
* must copy it. If the key doesn't have a name, this function * must copy it. If the key doesn't have a name, this function
@@ -232,7 +231,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
/** /**
* Get a key code from a human-readable name. * Get a key code from a human-readable name.
* *
* \param name the human-readable key name. * \param name the human-readable key name
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -254,10 +253,6 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* *
* On some platforms using this function activates the screen keyboard. * On some platforms using this function activates the screen keyboard.
* *
* On desktop platforms, SDL_StartTextInput() is implicitly called on SDL
* video subsystem initialization which will cause SDL_TextInputEvent and
* SDL_TextEditingEvent to begin emitting.
*
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
* \sa SDL_SetTextInputRect * \sa SDL_SetTextInputRect
@@ -303,10 +298,9 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
/** /**
* Set the rectangle used to type Unicode text inputs. * Set the rectangle used to type Unicode text inputs. Native input methods
* * will place a window with word suggestions near it, without covering the
* Native input methods will place a window with word suggestions near it, * text being inputted.
* without covering the text being inputted.
* *
* To start text input in a given location, this function is intended to be * To start text input in a given location, this function is intended to be
* called before SDL_StartTextInput, although some platforms support moving * called before SDL_StartTextInput, although some platforms support moving
@@ -317,7 +311,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
* any feedback. * any feedback.
* *
* \param rect the SDL_Rect structure representing the rectangle to receive * \param rect the SDL_Rect structure representing the rectangle to receive
* text (ignored if NULL). * text (ignored if NULL)
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -341,7 +335,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
/** /**
* Check whether the screen keyboard is shown for given window. * Check whether the screen keyboard is shown for given window.
* *
* \param window the window for which screen keyboard should be queried. * \param window the window for which screen keyboard should be queried
* \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryKeycode * \file SDL_keycode.h
* *
* Defines constants which identify keyboard keys and modifiers. * Defines constants which identify keyboard keys and modifiers.
*/ */
@@ -32,28 +32,22 @@
#include "SDL_scancode.h" #include "SDL_scancode.h"
/** /**
* The SDL virtual key representation. * \brief The SDL virtual key representation.
* *
* Values of this type are used to represent keyboard keys using the current * Values of this type are used to represent keyboard keys using the current
* layout of the keyboard. These values include Unicode values representing * layout of the keyboard. These values include Unicode values representing
* the unmodified character that would be generated by pressing the key, or an * the unmodified character that would be generated by pressing the key, or
* SDLK_* constant for those keys that do not generate characters. * an SDLK_* constant for those keys that do not generate characters.
* *
* A special exception is the number keys at the top of the keyboard which map * A special exception is the number keys at the top of the keyboard which
* to SDLK_0...SDLK_9 on AZERTY layouts. * map to SDLK_0...SDLK_9 on AZERTY layouts.
*
* The actual values that might be set for this type are listed in the
* SDL_KeyCode (capital C) enumeration.
*/ */
typedef Sint32 SDL_Keycode; typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1<<30) #define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
/** typedef enum
* The possible values for keycodes.
*/
typedef enum SDL_KeyCode
{ {
SDLK_UNKNOWN = 0, SDLK_UNKNOWN = 0,
@@ -333,9 +327,9 @@ typedef enum SDL_KeyCode
} SDL_KeyCode; } SDL_KeyCode;
/** /**
* Enumeration of valid key mods (possibly OR'd together). * \brief Enumeration of valid key mods (possibly OR'd together).
*/ */
typedef enum SDL_Keymod typedef enum
{ {
KMOD_NONE = 0x0000, KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001, KMOD_LSHIFT = 0x0001,

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,25 +19,23 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: LoadSO */
/** /**
* # CategoryLoadSO * \file SDL_loadso.h
* *
* System-dependent library loading routines. * System dependent library loading routines
* *
* Some things to keep in mind: * Some things to keep in mind:
* * \li These functions only work on C function names. Other languages may
* - These functions only work on C function names. Other languages may have * have name mangling and intrinsic language support that varies from
* name mangling and intrinsic language support that varies from compiler to * compiler to compiler.
* compiler. * \li Make sure you declare your function pointers with the same calling
* - Make sure you declare your function pointers with the same calling
* convention as the actual library function. Your code will crash * convention as the actual library function. Your code will crash
* mysteriously if you do not do this. * mysteriously if you do not do this.
* - Avoid namespace collisions. If you load a symbol from the library, it is * \li Avoid namespace collisions. If you load a symbol from the library,
* not defined whether or not it goes into the global symbol namespace for * it is not defined whether or not it goes into the global symbol
* the application. If it does and it conflicts with symbols in your code or * namespace for the application. If it does and it conflicts with
* other shared libraries, you will not get the results you expect. :) * symbols in your code or other shared libraries, you will not get
* the results you expect. :)
*/ */
#ifndef SDL_loadso_h_ #ifndef SDL_loadso_h_
@@ -55,7 +53,7 @@ extern "C" {
/** /**
* Dynamically load a shared object. * Dynamically load a shared object.
* *
* \param sofile a system-dependent name of the object file. * \param sofile a system-dependent name of the object file
* \returns an opaque pointer to the object handle or NULL if there was an * \returns an opaque pointer to the object handle or NULL if there was an
* error; call SDL_GetError() for more information. * error; call SDL_GetError() for more information.
* *
@@ -81,8 +79,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
* *
* If the requested function doesn't exist, NULL is returned. * If the requested function doesn't exist, NULL is returned.
* *
* \param handle a valid shared object handle returned by SDL_LoadObject(). * \param handle a valid shared object handle returned by SDL_LoadObject()
* \param name the name of the function to look up. * \param name the name of the function to look up
* \returns a pointer to the function or NULL if there was an error; call * \returns a pointer to the function or NULL if there was an error; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -97,7 +95,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
/** /**
* Unload a shared object from memory. * Unload a shared object from memory.
* *
* \param handle a valid shared object handle returned by SDL_LoadObject(). * \param handle a valid shared object handle returned by SDL_LoadObject()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryLocale * \file SDL_locale.h
* *
* Include file for SDL locale services * Include file for SDL locale services
*/ */

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryLog * \file SDL_log.h
* *
* Simple log messages with categories and priorities. * Simple log messages with categories and priorities.
* *
@@ -29,10 +29,9 @@
* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
* *
* Here's where the messages go on different platforms: * Here's where the messages go on different platforms:
* * Windows: debug output stream
* - Windows: debug output stream * Android: log output
* - Android: log output * Others: standard error output (stderr)
* - Others: standard error output (stderr)
*/ */
#ifndef SDL_log_h_ #ifndef SDL_log_h_
@@ -48,20 +47,21 @@ extern "C" {
/** /**
* The maximum size of a log message prior to SDL 2.0.24 * \brief The maximum size of a log message prior to SDL 2.0.24
* *
* As of 2.0.24 there is no limit to the length of SDL log messages. * As of 2.0.24 there is no limit to the length of SDL log messages.
*/ */
#define SDL_MAX_LOG_MESSAGE 4096 #define SDL_MAX_LOG_MESSAGE 4096
/** /**
* The predefined log categories * \brief The predefined log categories
* *
* By default the application category is enabled at the INFO level, the * By default the application category is enabled at the INFO level,
* assert category is enabled at the WARN level, test is enabled at the * the assert category is enabled at the WARN level, test is enabled
* VERBOSE level and all other categories are enabled at the ERROR level. * at the VERBOSE level and all other categories are enabled at the
* ERROR level.
*/ */
typedef enum SDL_LogCategory typedef enum
{ {
SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_ERROR,
@@ -97,9 +97,9 @@ typedef enum SDL_LogCategory
} SDL_LogCategory; } SDL_LogCategory;
/** /**
* The predefined log priorities * \brief The predefined log priorities
*/ */
typedef enum SDL_LogPriority typedef enum
{ {
SDL_LOG_PRIORITY_VERBOSE = 1, SDL_LOG_PRIORITY_VERBOSE = 1,
SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_DEBUG,
@@ -114,7 +114,7 @@ typedef enum SDL_LogPriority
/** /**
* Set the priority of all log categories. * Set the priority of all log categories.
* *
* \param priority the SDL_LogPriority to assign. * \param priority the SDL_LogPriority to assign
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -125,8 +125,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
/** /**
* Set the priority of a particular log category. * Set the priority of a particular log category.
* *
* \param category the category to assign a priority to. * \param category the category to assign a priority to
* \param priority the SDL_LogPriority to assign. * \param priority the SDL_LogPriority to assign
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -139,8 +139,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
/** /**
* Get the priority of a particular log category. * Get the priority of a particular log category.
* *
* \param category the category to query. * \param category the category to query
* \returns the SDL_LogPriority for the requested category. * \returns the SDL_LogPriority for the requested category
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -166,7 +166,7 @@ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
* = * \param fmt a printf() style message format string * = * \param fmt a printf() style message format string
* *
* \param ... additional parameters matching % tokens in the `fmt` string, if * \param ... additional parameters matching % tokens in the `fmt` string, if
* any. * any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -184,10 +184,10 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, .
/** /**
* Log a message with SDL_LOG_PRIORITY_VERBOSE. * Log a message with SDL_LOG_PRIORITY_VERBOSE.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -205,10 +205,10 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI
/** /**
* Log a message with SDL_LOG_PRIORITY_DEBUG. * Log a message with SDL_LOG_PRIORITY_DEBUG.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -226,10 +226,10 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_INFO. * Log a message with SDL_LOG_PRIORITY_INFO.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -247,10 +247,10 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_WARN. * Log a message with SDL_LOG_PRIORITY_WARN.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -268,10 +268,10 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_ERROR. * Log a message with SDL_LOG_PRIORITY_ERROR.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -289,10 +289,10 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_CRITICAL. * Log a message with SDL_LOG_PRIORITY_CRITICAL.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -310,11 +310,11 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR
/** /**
* Log a message with the specified category and priority. * Log a message with the specified category and priority.
* *
* \param category the category of the message. * \param category the category of the message
* \param priority the priority of the message. * \param priority the priority of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -334,10 +334,10 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
/** /**
* Log a message with the specified category and priority. * Log a message with the specified category and priority.
* *
* \param category the category of the message. * \param category the category of the message
* \param priority the priority of the message. * \param priority the priority of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ap a variable argument list. * \param ap a variable argument list
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -359,11 +359,10 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
* *
* This function is called by SDL when there is new text to be logged. * This function is called by SDL when there is new text to be logged.
* *
* \param userdata what was passed as `userdata` to * \param userdata what was passed as `userdata` to SDL_LogSetOutputFunction()
* SDL_LogSetOutputFunction(). * \param category the category of the message
* \param category the category of the message. * \param priority the priority of the message
* \param priority the priority of the message. * \param message the message being output
* \param message the message being output.
*/ */
typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
@@ -371,9 +370,9 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_
* Get the current log output function. * Get the current log output function.
* *
* \param callback an SDL_LogOutputFunction filled in with the current log * \param callback an SDL_LogOutputFunction filled in with the current log
* callback. * callback
* \param userdata a pointer filled in with the pointer that is passed to * \param userdata a pointer filled in with the pointer that is passed to
* `callback`. * `callback`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -384,8 +383,8 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal
/** /**
* Replace the default log output function with one of your own. * Replace the default log output function with one of your own.
* *
* \param callback an SDL_LogOutputFunction to call instead of the default. * \param callback an SDL_LogOutputFunction to call instead of the default
* \param userdata a pointer that is passed to `callback`. * \param userdata a pointer that is passed to `callback`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -25,7 +25,7 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
/** /**
* # CategoryMain * \file SDL_main.h
* *
* Redefine main() on some platforms so that it is called by SDL. * Redefine main() on some platforms so that it is called by SDL.
*/ */
@@ -129,14 +129,14 @@
* *
* The application's main() function must be called with C linkage, * The application's main() function must be called with C linkage,
* and should be declared like this: * and should be declared like this:
* ```c * \code
* #ifdef __cplusplus * #ifdef __cplusplus
* extern "C" * extern "C"
* #endif * #endif
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* } * }
* ``` * \endcode
*/ */
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
@@ -187,8 +187,8 @@ extern DECLSPEC void SDLCALL SDL_SetMainReady(void);
* \param name the window class name, in UTF-8 encoding. If NULL, SDL * \param name the window class name, in UTF-8 encoding. If NULL, SDL
* currently uses "SDL_app" but this isn't guaranteed. * currently uses "SDL_app" but this isn't guaranteed.
* \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL * \param style the value to use in WNDCLASSEX::style. If `name` is NULL, SDL
* currently uses `(CS_BYTEALIGNCLIENT \| CS_OWNDC)` regardless * currently uses `(CS_BYTEALIGNCLIENT | CS_OWNDC)` regardless of
* of what is specified here. * what is specified here.
* \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL * \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL
* will use `GetModuleHandle(NULL)` instead. * will use `GetModuleHandle(NULL)` instead.
* \returns 0 on success, -1 on error. SDL_GetError() may have details. * \returns 0 on success, -1 on error. SDL_GetError() may have details.
@@ -222,8 +222,8 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
/** /**
* Initialize and launch an SDL/WinRT application. * Initialize and launch an SDL/WinRT application.
* *
* \param mainFunction the SDL app's C-style main(), an SDL_main_func. * \param mainFunction the SDL app's C-style main(), an SDL_main_func
* \param reserved reserved for future use; should be NULL. * \param reserved reserved for future use; should be NULL
* \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
* more information on the failure. * more information on the failure.
* *
@@ -238,10 +238,10 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * r
/** /**
* Initializes and launches an SDL application. * Initializes and launches an SDL application.
* *
* \param argc The argc parameter from the application's main() function. * \param argc The argc parameter from the application's main() function
* \param argv The argv parameter from the application's main() function. * \param argv The argv parameter from the application's main() function
* \param mainFunction The SDL app's C-style main(), an SDL_main_func. * \param mainFunction The SDL app's C-style main(), an SDL_main_func
* \return the return value from mainFunction. * \return the return value from mainFunction
* *
* \since This function is available since SDL 2.0.10. * \since This function is available since SDL 2.0.10.
*/ */
@@ -254,8 +254,8 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun
/** /**
* Initialize and launch an SDL GDK application. * Initialize and launch an SDL GDK application.
* *
* \param mainFunction the SDL app's C-style main(), an SDL_main_func. * \param mainFunction the SDL app's C-style main(), an SDL_main_func
* \param reserved reserved for future use; should be NULL. * \param reserved reserved for future use; should be NULL
* \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
* more information on the failure. * more information on the failure.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -32,11 +32,9 @@ extern "C" {
#endif #endif
/** /**
* SDL_MessageBox flags. * SDL_MessageBox flags. If supported will display warning icon, etc.
*
* If supported will display warning icon, etc.
*/ */
typedef enum SDL_MessageBoxFlags typedef enum
{ {
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
@@ -48,7 +46,7 @@ typedef enum SDL_MessageBoxFlags
/** /**
* Flags for SDL_MessageBoxButtonData. * Flags for SDL_MessageBoxButtonData.
*/ */
typedef enum SDL_MessageBoxButtonFlags typedef enum
{ {
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
@@ -57,9 +55,9 @@ typedef enum SDL_MessageBoxButtonFlags
/** /**
* Individual button data. * Individual button data.
*/ */
typedef struct SDL_MessageBoxButtonData typedef struct
{ {
Uint32 flags; /**< SDL_MessageBoxButtonFlags */ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
const char * text; /**< The UTF-8 button text */ const char * text; /**< The UTF-8 button text */
} SDL_MessageBoxButtonData; } SDL_MessageBoxButtonData;
@@ -67,12 +65,12 @@ typedef struct SDL_MessageBoxButtonData
/** /**
* RGB value used in a message box color scheme * RGB value used in a message box color scheme
*/ */
typedef struct SDL_MessageBoxColor typedef struct
{ {
Uint8 r, g, b; Uint8 r, g, b;
} SDL_MessageBoxColor; } SDL_MessageBoxColor;
typedef enum SDL_MessageBoxColorType typedef enum
{ {
SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_BACKGROUND,
SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_TEXT,
@@ -85,7 +83,7 @@ typedef enum SDL_MessageBoxColorType
/** /**
* A set of colors to use for message box dialogs * A set of colors to use for message box dialogs
*/ */
typedef struct SDL_MessageBoxColorScheme typedef struct
{ {
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
} SDL_MessageBoxColorScheme; } SDL_MessageBoxColorScheme;
@@ -93,9 +91,9 @@ typedef struct SDL_MessageBoxColorScheme
/** /**
* MessageBox structure containing title, text, window, etc. * MessageBox structure containing title, text, window, etc.
*/ */
typedef struct SDL_MessageBoxData typedef struct
{ {
Uint32 flags; /**< SDL_MessageBoxFlags */ Uint32 flags; /**< ::SDL_MessageBoxFlags */
SDL_Window *window; /**< Parent window, can be NULL */ SDL_Window *window; /**< Parent window, can be NULL */
const char *title; /**< UTF-8 title */ const char *title; /**< UTF-8 title */
const char *message; /**< UTF-8 message text */ const char *message; /**< UTF-8 message text */
@@ -103,7 +101,7 @@ typedef struct SDL_MessageBoxData
int numbuttons; int numbuttons;
const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxButtonData *buttons;
const SDL_MessageBoxColorScheme *colorScheme; /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */ const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
} SDL_MessageBoxData; } SDL_MessageBoxData;
/** /**
@@ -130,9 +128,8 @@ typedef struct SDL_MessageBoxData
* to stderr if you can. * to stderr if you can.
* *
* \param messageboxdata the SDL_MessageBoxData structure with title, text and * \param messageboxdata the SDL_MessageBoxData structure with title, text and
* other options. * other options
* \param buttonid the pointer to which user id of hit button should be * \param buttonid the pointer to which user id of hit button should be copied
* copied.
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -171,10 +168,10 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message
* concern, check the return value from this function and fall back to writing * concern, check the return value from this function and fall back to writing
* to stderr if you can. * to stderr if you can.
* *
* \param flags an SDL_MessageBoxFlags value. * \param flags an SDL_MessageBoxFlags value
* \param title UTF-8 title text. * \param title UTF-8 title text
* \param message UTF-8 message text. * \param message UTF-8 message text
* \param window the parent window, or NULL for no parent. * \param window the parent window, or NULL for no parent
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,10 +20,9 @@
*/ */
/** /**
* # CategoryMetal * \file SDL_metal.h
* *
* Header file for functions to creating Metal layers and views on SDL * Header file for functions to creating Metal layers and views on SDL windows.
* windows.
*/ */
#ifndef SDL_metal_h_ #ifndef SDL_metal_h_
@@ -38,9 +37,9 @@ extern "C" {
#endif #endif
/** /**
* A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
* *
* This can be cast directly to an NSView or UIView. * \note This can be cast directly to an NSView or UIView.
*/ */
typedef void *SDL_MetalView; typedef void *SDL_MetalView;
@@ -91,9 +90,9 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
* Get the size of a window's underlying drawable in pixels (for use with * Get the size of a window's underlying drawable in pixels (for use with
* setting viewport, scissor & etc). * setting viewport, scissor & etc).
* *
* \param window SDL_Window from which the drawable size should be queried. * \param window SDL_Window from which the drawable size should be queried
* \param w Pointer to variable for storing the width in pixels, may be NULL. * \param w Pointer to variable for storing the width in pixels, may be NULL
* \param h Pointer to variable for storing the height in pixels, may be NULL. * \param h Pointer to variable for storing the height in pixels, may be NULL
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryMisc * \file SDL_misc.h
* *
* Include file for SDL API functions that don't fit elsewhere. * \brief Include file for SDL API functions that don't fit elsewhere.
*/ */
#ifndef SDL_misc_h_ #ifndef SDL_misc_h_

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryMouse * \file SDL_mouse.h
* *
* Include file for SDL mouse event handling. * Include file for SDL mouse event handling.
*/ */
@@ -41,9 +41,9 @@ extern "C" {
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/** /**
* Cursor types for SDL_CreateSystemCursor(). * \brief Cursor types for SDL_CreateSystemCursor().
*/ */
typedef enum SDL_SystemCursor typedef enum
{ {
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
@@ -61,9 +61,9 @@ typedef enum SDL_SystemCursor
} SDL_SystemCursor; } SDL_SystemCursor;
/** /**
* Scroll direction types for the Scroll event * \brief Scroll direction types for the Scroll event
*/ */
typedef enum SDL_MouseWheelDirection typedef enum
{ {
SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */ SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */ SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
@@ -90,9 +90,9 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
* either `x` or `y`. * either `x` or `y`.
* *
* \param x the x coordinate of the mouse cursor position relative to the * \param x the x coordinate of the mouse cursor position relative to the
* focus window. * focus window
* \param y the y coordinate of the mouse cursor position relative to the * \param y the y coordinate of the mouse cursor position relative to the
* focus window. * focus window
* \returns a 32-bit button bitmask of the current button state. * \returns a 32-bit button bitmask of the current button state.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -120,9 +120,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
* reason to use this function, you probably want SDL_GetMouseState() instead. * reason to use this function, you probably want SDL_GetMouseState() instead.
* *
* \param x filled in with the current X coord relative to the desktop; can be * \param x filled in with the current X coord relative to the desktop; can be
* NULL. * NULL
* \param y filled in with the current Y coord relative to the desktop; can be * \param y filled in with the current Y coord relative to the desktop; can be
* NULL. * NULL
* \returns the current button state as a bitmask which can be tested using * \returns the current button state as a bitmask which can be tested using
* the SDL_BUTTON(X) macros. * the SDL_BUTTON(X) macros.
* *
@@ -141,8 +141,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
* mouse deltas since the last call to SDL_GetRelativeMouseState() or since * mouse deltas since the last call to SDL_GetRelativeMouseState() or since
* event initialization. You can pass NULL for either `x` or `y`. * event initialization. You can pass NULL for either `x` or `y`.
* *
* \param x a pointer filled with the last recorded x coordinate of the mouse. * \param x a pointer filled with the last recorded x coordinate of the mouse
* \param y a pointer filled with the last recorded y coordinate of the mouse. * \param y a pointer filled with the last recorded y coordinate of the mouse
* \returns a 32-bit button bitmask of the relative button state. * \returns a 32-bit button bitmask of the relative button state.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -162,9 +162,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
* mouse when used over Microsoft Remote Desktop. * mouse when used over Microsoft Remote Desktop.
* *
* \param window the window to move the mouse into, or NULL for the current * \param window the window to move the mouse into, or NULL for the current
* mouse focus. * mouse focus
* \param x the x coordinate within the window. * \param x the x coordinate within the window
* \param y the y coordinate within the window. * \param y the y coordinate within the window
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -184,8 +184,8 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
* Note that this function will appear to succeed, but not actually move the * Note that this function will appear to succeed, but not actually move the
* mouse when used over Microsoft Remote Desktop. * mouse when used over Microsoft Remote Desktop.
* *
* \param x the x coordinate. * \param x the x coordinate
* \param y the y coordinate. * \param y the y coordinate
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -297,14 +297,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
* Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which
* provides twelve readily available system cursors to pick from. * provides twelve readily available system cursors to pick from.
* *
* \param data the color value for each pixel of the cursor. * \param data the color value for each pixel of the cursor
* \param mask the mask value for each pixel of the cursor. * \param mask the mask value for each pixel of the cursor
* \param w the width of the cursor. * \param w the width of the cursor
* \param h the height of the cursor. * \param h the height of the cursor
* \param hot_x the X-axis location of the upper left corner of the cursor * \param hot_x the X-axis location of the upper left corner of the cursor
* relative to the actual mouse position. * relative to the actual mouse position
* \param hot_y the Y-axis location of the upper left corner of the cursor * \param hot_y the Y-axis location of the upper left corner of the cursor
* relative to the actual mouse position. * relative to the actual mouse position
* \returns a new cursor with the specified parameters on success or NULL on * \returns a new cursor with the specified parameters on success or NULL on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -322,9 +322,9 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
/** /**
* Create a color cursor. * Create a color cursor.
* *
* \param surface an SDL_Surface structure representing the cursor image. * \param surface an SDL_Surface structure representing the cursor image
* \param hot_x the x position of the cursor hot spot. * \param hot_x the x position of the cursor hot spot
* \param hot_y the y position of the cursor hot spot. * \param hot_y the y position of the cursor hot spot
* \returns the new cursor on success or NULL on failure; call SDL_GetError() * \returns the new cursor on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -340,7 +340,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
/** /**
* Create a system cursor. * Create a system cursor.
* *
* \param id an SDL_SystemCursor enum value. * \param id an SDL_SystemCursor enum value
* \returns a cursor on success or NULL on failure; call SDL_GetError() for * \returns a cursor on success or NULL on failure; call SDL_GetError() for
* more information. * more information.
* *
@@ -358,7 +358,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
* the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if
* this is desired for any reason. * this is desired for any reason.
* *
* \param cursor a cursor to make active. * \param cursor a cursor to make active
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -402,7 +402,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
* Use this function to free cursor resources created with SDL_CreateCursor(), * Use this function to free cursor resources created with SDL_CreateCursor(),
* SDL_CreateColorCursor() or SDL_CreateSystemCursor(). * SDL_CreateColorCursor() or SDL_CreateSystemCursor().
* *
* \param cursor the cursor to free. * \param cursor the cursor to free
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -23,7 +23,7 @@
#define SDL_mutex_h_ #define SDL_mutex_h_
/** /**
* # CategoryMutex * \file SDL_mutex.h
* *
* Functions to provide thread synchronization primitives. * Functions to provide thread synchronization primitives.
*/ */
@@ -112,8 +112,8 @@ extern "C" {
#endif #endif
/** /**
* Synchronization functions which can time out return this value if they time * Synchronization functions which can time out return this value
* out. * if they time out.
*/ */
#define SDL_MUTEX_TIMEDOUT 1 #define SDL_MUTEX_TIMEDOUT 1
@@ -165,7 +165,7 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
* unlock it the same number of times before it is actually made available for * unlock it the same number of times before it is actually made available for
* other threads in the system (this is known as a "recursive mutex"). * other threads in the system (this is known as a "recursive mutex").
* *
* \param mutex the mutex to lock. * \param mutex the mutex to lock
* \return 0, or -1 on error. * \return 0, or -1 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -182,7 +182,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex);
* This technique is useful if you need exclusive access to a resource but * This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later. * don't want to wait for it, and will return to it to try again later.
* *
* \param mutex the mutex to try to lock. * \param mutex the mutex to try to lock
* \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for * \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for
* more information. * more information.
* *
@@ -224,7 +224,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex
* to destroy a locked mutex, and may result in undefined behavior depending * to destroy a locked mutex, and may result in undefined behavior depending
* on the platform. * on the platform.
* *
* \param mutex the mutex to destroy. * \param mutex the mutex to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -256,7 +256,7 @@ typedef struct SDL_semaphore SDL_sem;
* is 0. Each post operation will atomically increment the semaphore value and * is 0. Each post operation will atomically increment the semaphore value and
* wake waiting threads and allow them to retry the wait operation. * wake waiting threads and allow them to retry the wait operation.
* *
* \param initial_value the starting value of the semaphore. * \param initial_value the starting value of the semaphore
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more * \returns a new semaphore or NULL on failure; call SDL_GetError() for more
* information. * information.
* *
@@ -277,7 +277,7 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
* It is not safe to destroy a semaphore if there are threads currently * It is not safe to destroy a semaphore if there are threads currently
* waiting on it. * waiting on it.
* *
* \param sem the semaphore to destroy. * \param sem the semaphore to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -301,7 +301,7 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
* This function is the equivalent of calling SDL_SemWaitTimeout() with a time * This function is the equivalent of calling SDL_SemWaitTimeout() with a time
* length of `SDL_MUTEX_MAXWAIT`. * length of `SDL_MUTEX_MAXWAIT`.
* *
* \param sem the semaphore wait on. * \param sem the semaphore wait on
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -325,7 +325,7 @@ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
* the semaphore doesn't have a positive value, the function immediately * the semaphore doesn't have a positive value, the function immediately
* returns SDL_MUTEX_TIMEDOUT. * returns SDL_MUTEX_TIMEDOUT.
* *
* \param sem the semaphore to wait on. * \param sem the semaphore to wait on
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would * \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would
* block, or a negative error code on failure; call SDL_GetError() * block, or a negative error code on failure; call SDL_GetError()
* for more information. * for more information.
@@ -349,8 +349,8 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
* signal or error, or the specified time has elapsed. If the call is * signal or error, or the specified time has elapsed. If the call is
* successful it will atomically decrement the semaphore value. * successful it will atomically decrement the semaphore value.
* *
* \param sem the semaphore to wait on. * \param sem the semaphore to wait on
* \param timeout the length of the timeout, in milliseconds. * \param timeout the length of the timeout, in milliseconds
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not * \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not
* succeed in the allotted time, or a negative error code on failure; * succeed in the allotted time, or a negative error code on failure;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
@@ -369,7 +369,7 @@ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout);
/** /**
* Atomically increment a semaphore's value and wake waiting threads. * Atomically increment a semaphore's value and wake waiting threads.
* *
* \param sem the semaphore to increment. * \param sem the semaphore to increment
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -387,7 +387,7 @@ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
/** /**
* Get the current value of a semaphore. * Get the current value of a semaphore.
* *
* \param sem the semaphore to query. * \param sem the semaphore to query
* \returns the current value of the semaphore. * \returns the current value of the semaphore.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -427,7 +427,7 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
/** /**
* Destroy a condition variable. * Destroy a condition variable.
* *
* \param cond the condition variable to destroy. * \param cond the condition variable to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -442,7 +442,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
/** /**
* Restart one of the threads that are waiting on the condition variable. * Restart one of the threads that are waiting on the condition variable.
* *
* \param cond the condition variable to signal. * \param cond the condition variable to signal
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -459,7 +459,7 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
/** /**
* Restart all threads that are waiting on the condition variable. * Restart all threads that are waiting on the condition variable.
* *
* \param cond the condition variable to signal. * \param cond the condition variable to signal
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -486,8 +486,8 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
* This function is the equivalent of calling SDL_CondWaitTimeout() with a * This function is the equivalent of calling SDL_CondWaitTimeout() with a
* time length of `SDL_MUTEX_MAXWAIT`. * time length of `SDL_MUTEX_MAXWAIT`.
* *
* \param cond the condition variable to wait on. * \param cond the condition variable to wait on
* \param mutex the mutex used to coordinate thread access. * \param mutex the mutex used to coordinate thread access
* \returns 0 when it is signaled or a negative error code on failure; call * \returns 0 when it is signaled or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -512,10 +512,10 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
* *
* The mutex must be locked before calling this function. * The mutex must be locked before calling this function.
* *
* \param cond the condition variable to wait on. * \param cond the condition variable to wait on
* \param mutex the mutex used to coordinate thread access. * \param mutex the mutex used to coordinate thread access
* \param ms the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT` * \param ms the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT`
* to wait indefinitely. * to wait indefinitely
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if * \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
* the condition is not signaled in the allotted time, or a negative * the condition is not signaled in the allotted time, or a negative
* error code on failure; call SDL_GetError() for more information. * error code on failure; call SDL_GetError() for more information.

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,11 +19,17 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* This is a simple file to encapsulate the OpenGL API headers. * \file SDL_opengl.h
* *
* Define NO_SDL_GLEXT if you have your own version of glext.h and want * This is a simple file to encapsulate the OpenGL API headers.
* to disable the version included in SDL_opengl.h. */
/**
* \def NO_SDL_GLEXT
*
* Define this if you have your own version of glext.h and want to disable the
* version included in SDL_opengl.h.
*/ */
#ifndef SDL_opengl_h_ #ifndef SDL_opengl_h_

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_opengles.h
*
* This is a simple file to encapsulate the OpenGL ES 1.X API headers. * This is a simple file to encapsulate the OpenGL ES 1.X API headers.
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifdef __IPHONEOS__ #ifdef __IPHONEOS__

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_opengles2.h
*
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers. * This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryPixels * \file SDL_pixels.h
* *
* Header for the enumerated pixel format definitions. * Header for the enumerated pixel format definitions.
*/ */
@@ -320,10 +320,9 @@ typedef enum
} SDL_PixelFormatEnum; } SDL_PixelFormatEnum;
/** /**
* The bits of this structure can be directly reinterpreted as an * The bits of this structure can be directly reinterpreted as an integer-packed
* integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
* (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
* SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
*/ */
typedef struct SDL_Color typedef struct SDL_Color
{ {
@@ -343,30 +342,7 @@ typedef struct SDL_Palette
} SDL_Palette; } SDL_Palette;
/** /**
* A structure that contains pixel format information. * \note Everything in the pixel format structure is read-only.
*
* Everything in the pixel format structure is read-only.
*
* A pixel format has either a palette or masks. If a palette is used `Rmask`,
* `Gmask`, `Bmask`, and `Amask` will be 0.
*
* An SDL_PixelFormat describes the format of the pixel data stored at the
* `pixels` field of an SDL_Surface. Every surface stores an SDL_PixelFormat
* in the `format` field.
*
* If you wish to do pixel level modifications on a surface, then
* understanding how SDL stores its color information is essential.
*
* For information on modern pixel color spaces, see the following Wikipedia
* article: http://en.wikipedia.org/wiki/RGBA_color_space
*
* \sa SDL_ConvertSurface
* \sa SDL_GetRGB
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
* \sa SDL_AllocFormat
* \sa SDL_FreeFormat
*/ */
typedef struct SDL_PixelFormat typedef struct SDL_PixelFormat
{ {
@@ -394,7 +370,7 @@ typedef struct SDL_PixelFormat
/** /**
* Get the human readable name of a pixel format. * Get the human readable name of a pixel format.
* *
* \param format the pixel format to query. * \param format the pixel format to query
* \returns the human readable name of the specified pixel format or * \returns the human readable name of the specified pixel format or
* `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
* *
@@ -405,12 +381,12 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
/** /**
* Convert one of the enumerated pixel formats to a bpp value and RGBA masks. * Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
* *
* \param format one of the SDL_PixelFormatEnum values. * \param format one of the SDL_PixelFormatEnum values
* \param bpp a bits per pixel value; usually 15, 16, or 32. * \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask a pointer filled in with the red mask for the format. * \param Rmask a pointer filled in with the red mask for the format
* \param Gmask a pointer filled in with the green mask for the format. * \param Gmask a pointer filled in with the green mask for the format
* \param Bmask a pointer filled in with the blue mask for the format. * \param Bmask a pointer filled in with the blue mask for the format
* \param Amask a pointer filled in with the alpha mask for the format. * \param Amask a pointer filled in with the alpha mask for the format
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
* possible; call SDL_GetError() for more information. * possible; call SDL_GetError() for more information.
* *
@@ -431,12 +407,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
* This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
* possible. * possible.
* *
* \param bpp a bits per pixel value; usually 15, 16, or 32. * \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask the red mask for the format. * \param Rmask the red mask for the format
* \param Gmask the green mask for the format. * \param Gmask the green mask for the format
* \param Bmask the blue mask for the format. * \param Bmask the blue mask for the format
* \param Amask the alpha mask for the format. * \param Amask the alpha mask for the format
* \returns one of the SDL_PixelFormatEnum values. * \returns one of the SDL_PixelFormatEnum values
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -455,7 +431,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
* allocated), and hence should not be modified, especially the palette. Weird * allocated), and hence should not be modified, especially the palette. Weird
* errors such as `Blit combination not supported` may occur. * errors such as `Blit combination not supported` may occur.
* *
* \param pixel_format one of the SDL_PixelFormatEnum values. * \param pixel_format one of the SDL_PixelFormatEnum values
* \returns the new SDL_PixelFormat structure or NULL on failure; call * \returns the new SDL_PixelFormat structure or NULL on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -468,7 +444,7 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
/** /**
* Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
* *
* \param format the SDL_PixelFormat structure to free. * \param format the SDL_PixelFormat structure to free
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -481,7 +457,7 @@ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
* *
* The palette entries are initialized to white. * The palette entries are initialized to white.
* *
* \param ncolors represents the number of color entries in the color palette. * \param ncolors represents the number of color entries in the color palette
* \returns a new SDL_Palette structure on success or NULL on failure (e.g. if * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
* there wasn't enough memory); call SDL_GetError() for more * there wasn't enough memory); call SDL_GetError() for more
* information. * information.
@@ -495,8 +471,8 @@ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
/** /**
* Set the palette for a pixel format structure. * Set the palette for a pixel format structure.
* *
* \param format the SDL_PixelFormat structure that will use the palette. * \param format the SDL_PixelFormat structure that will use the palette
* \param palette the SDL_Palette structure that will be used. * \param palette the SDL_Palette structure that will be used
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -511,10 +487,10 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
/** /**
* Set a range of colors in a palette. * Set a range of colors in a palette.
* *
* \param palette the SDL_Palette structure to modify. * \param palette the SDL_Palette structure to modify
* \param colors an array of SDL_Color structures to copy into the palette. * \param colors an array of SDL_Color structures to copy into the palette
* \param firstcolor the index of the first palette entry to modify. * \param firstcolor the index of the first palette entry to modify
* \param ncolors the number of entries to modify. * \param ncolors the number of entries to modify
* \returns 0 on success or a negative error code if not all of the colors * \returns 0 on success or a negative error code if not all of the colors
* could be set; call SDL_GetError() for more information. * could be set; call SDL_GetError() for more information.
* *
@@ -530,7 +506,7 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
/** /**
* Free a palette created with SDL_AllocPalette(). * Free a palette created with SDL_AllocPalette().
* *
* \param palette the SDL_Palette structure to be freed. * \param palette the SDL_Palette structure to be freed
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -556,11 +532,11 @@ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
* format the return value can be assigned to a Uint16, and similarly a Uint8 * format the return value can be assigned to a Uint16, and similarly a Uint8
* for an 8-bpp format). * for an 8-bpp format).
* *
* \param format an SDL_PixelFormat structure describing the pixel format. * \param format an SDL_PixelFormat structure describing the pixel format
* \param r the red component of the pixel in the range 0-255. * \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255
* \returns a pixel value. * \returns a pixel value
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -590,12 +566,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
* for an 8-bpp format). * for an 8-bpp format).
* *
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r the red component of the pixel in the range 0-255. * \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255
* \param a the alpha component of the pixel in the range 0-255. * \param a the alpha component of the pixel in the range 0-255
* \returns a pixel value. * \returns a pixel value
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -615,12 +591,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
* *
* \param pixel a pixel value. * \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r a pointer filled in with the red component. * \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component. * \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component. * \param b a pointer filled in with the blue component
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -643,13 +619,13 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
* If the surface has no alpha component, the alpha will be returned as 0xff * If the surface has no alpha component, the alpha will be returned as 0xff
* (100% opaque). * (100% opaque).
* *
* \param pixel a pixel value. * \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r a pointer filled in with the red component. * \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component. * \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component. * \param b a pointer filled in with the blue component
* \param a a pointer filled in with the alpha component. * \param a a pointer filled in with the alpha component
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -665,8 +641,8 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
/** /**
* Calculate a 256 entry gamma ramp for a gamma value. * Calculate a 256 entry gamma ramp for a gamma value.
* *
* \param gamma a gamma value where 0.0 is black and 1.0 is identity. * \param gamma a gamma value where 0.0 is black and 1.0 is identity
* \param ramp an array of 256 values filled in with the gamma ramp. * \param ramp an array of 256 values filled in with the gamma ramp
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View File

@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryPlatform * \file SDL_platform.h
* *
* Try to get a standard set of platform defines. * Try to get a standard set of platform defines.
*/ */

Some files were not shown because too many files have changed in this diff Show More