Commit Graph

1865 Commits (080b1dfbdb7db0b3db3bf2f750cb645cf3397b74)

Author SHA1 Message Date
Sam Lantinga 080b1dfbdb Revert "Improved fallback for SDL_COMPILE_TIME_ASSERT() (thanks @icculus!)"
This reverts commit 9d453daa23.

Oops, it totally doesn't work:
error: unused variable 'SDL_compile_time_assert_SDL_copyp' [-Werror=unused-variable]
2023-08-05 19:23:30 -07:00
Sam Lantinga 9d453daa23 Improved fallback for SDL_COMPILE_TIME_ASSERT() (thanks @icculus!) 2023-08-05 19:18:31 -07:00
Sam Lantinga 1fb2419882 Removed reference to renamed function 2023-08-05 19:11:10 -07:00
Ryan C. Gordon e7d56dd0b2
audio: Renamed new API SDL_UnpauseAudioDevice to SDL_ResumeAudioDevice. 2023-08-05 19:20:14 -04:00
SDL Wiki Bot 4bb426abad Sync SDL3 wiki -> header 2023-08-05 17:45:14 +00:00
meyraud705 3a752ce650 Reapply "Changed 'freesrc' parameter from int to SDL_bool" to SDL_wave.c
Commit bea99d4 was partially reverted by 905c4ff "audio: First shot at the SDL3 audio subsystem redesign!"
2023-08-05 13:44:48 -04:00
SDL Wiki Bot 35ad68e126 Sync SDL3 wiki -> header 2023-08-04 17:40:16 +00:00
Frank Praznik 70323a8350 Add a function to display the system menu for a window
Add SDL_ShowWindowSystemMenu() to display the system-level menu for windows. Typically, this is done by right-clicking on the system provided window decorations, however, if an application is rendering its own client-side decorations, there is currently no way to display it. This menu is provided by the system and can provide privileged desktop functionality such as moving or pinning a window to a specific workspace or display, setting the always-on-top property, or taking screenshots. In many cases, there are no APIs which allow applications to perform these actions manually.

Implemented for Wayland via functionality provided by the xdg_toplevel protocol, Win32 via the undocumented message 0x313 (typically called WM_POPUPSYSTEMMENU), and X11 via the "_GTK_SHOW_WINDOW_MENU" atom (supported in GNOME and KDE).
2023-08-04 13:39:45 -04:00
SDL Wiki Bot c0a88930bf Sync SDL3 wiki -> header 2023-08-04 01:28:15 +00:00
Ryan C. Gordon 18c59cc969
Merge the SDL3 audio subsystem redesign!
This rips up the entire SDL audio subsystem! While we still feed the audio device from a separate thread, the audio callback into the app is now gone a totally optional alternative.

Now the app will bind an SDL_AudioStream to a given device and feed data to it. As many streams as one likes can be bound to a device; SDL will mix them all into a single buffer and feed the device from there.

So not only does this function as a basic mixer, it also means that multiple device opens are handled seamlessly (so if you want to open the device for your game, but you also link to a library that provides VoIP and it wants to open the device separately, you don't have to worry about stepping on each other, or that the OS will fail to allow multiple opens of the same device, etc).

Merged from pull request #7704.

Fixes #7379.
Reference Issue #6889.
Reference Issue #6632.
2023-08-03 21:27:54 -04:00
SDL Wiki Bot 8f00d7856d Sync SDL3 wiki -> header 2023-07-31 23:40:15 +00:00
Semphris d4a867a256 Rename SDL_GetPath to SDL_GetUserFolder
The documentation has been edited accordingly, and certain parts have been clarified.
2023-07-31 16:39:33 -07:00
Sam Lantinga b7f32f74ce Note the removal of the SDL_RENDERER_TARGETTEXTURE flag
Render targets are a core feature of SDL 3.0, so this flag has been removed.

The OpenGL ES renderer still doesn't support them, but we'll deal with that later.

Fixes https://github.com/libsdl-org/SDL/issues/8059
2023-07-31 08:36:44 -07:00
Ryan C. Gordon 660054f3dc
include: Correct comment about audio device hotplug events. 2023-07-30 11:56:41 -04:00
Ryan C. Gordon db39cbf208
audio: Allow SDL_GetAudioDeviceFormat() to query the default devices.
Officially removed SDL_GetDefaultAudioInfo(), as its functionality that
isn't obsolete is now offered elsewhere.
2023-07-30 11:55:55 -04:00
Ryan C. Gordon 464640440f
audio: Added SDL_GetAudioStreamBinding.
Now you can open a device, bind a stream, and forget about the device ID
until you're ready to shutdown, where you can query the stream for it.
2023-07-30 11:55:54 -04:00
Ryan C. Gordon 01f7b53865
audio: Readded (logical) device pausing. 2023-07-30 11:55:53 -04:00
Ryan C. Gordon fd4c9f4e11
audio: documentation improvements. 2023-07-30 11:55:53 -04:00
Ryan C. Gordon b2e020958f
audio: Wrap device access in opening of logical devices.
Now you open an audio device and attach streams, as planned, but each
open generates a new logical device. Each logical device has its own
streams that are managed as a group, but all streams on all logical
devices are mixed into a single buffer for a single OS-level open of
the physical device.

This allows multiple opens of a device that won't interfere with each
other and also clean up just what the opener assigned to their logical
device, so all their streams will go away on close but other opens will
continue to mix as they were.

More or less, this makes things work as expected at the app level, but
also gives them the power to group audio streams, and (once added) pause
them all at once, etc.
2023-07-30 11:55:53 -04:00
Ryan C. Gordon 3d65a2cefe
audio: Made SDL_LoadWAV a real function, not just a macro. 2023-07-30 11:55:52 -04:00
Ryan C. Gordon 26525f5fd3
audio: Readd SDL_AudioSpec, but just with format/channels/freq fields. 2023-07-30 11:55:52 -04:00
Ryan C. Gordon e6aaed7d79
include: Audio is not, and has not been, a raw mixing buffer for a long time. 2023-07-30 11:55:52 -04:00
Ryan C. Gordon 56b1bc2198
audio: SDL_AudioStream now has callbacks for Get and Put operations.
This allows code to feed a stream (or feed from a stream) on-demand,
which is to say: it can efficiently simulate the SDL2 audio callback.
2023-07-30 11:55:51 -04:00
Ryan C. Gordon 905c4fff5b
audio: First shot at the SDL3 audio subsystem redesign!
This is a work in progress! (and this commit will probably get
force-pushed over at some point).
2023-07-30 11:55:51 -04:00
Sam Lantinga 0dc85f3078 Improved the documentation for the gamepad paddle buttons 2023-07-27 11:27:42 -07:00
SDL Wiki Bot d086d9874d Sync SDL3 wiki -> header 2023-07-27 13:36:07 +00:00
SDL Wiki Bot ad0c0d3cde Sync SDL3 wiki -> header 2023-07-26 17:17:06 +00:00
Starbuck5 666f81bace Add more endian-specific aliases for 32 bit pixelformats
Add these for all the RGBX variants, just like all the RGBA variants already have.
2023-07-25 23:35:42 -07:00
Anonymous Maarten 8105f1d5b5 SDL_atomic.h: __ARM_ARCH is not always defined for an arm platform
e.g. riscos toolchain
2023-07-22 15:55:48 -04:00
Anonymous Maarten 3ab4665956 cmake: bump minimum required CMake version to 3.16
main features:

- No more sdl-build-options/sdl-shared-build-options/sdl-global-options
- Dependency information is stored on SDL3-collector for sdl3.pc
- Use helper functions to modify the SDL targets;
    - sdl_sources to add sources
    - sdl_glob_sources to add glob soruces
    - sdl_link_dependency to add a link dependency that might also
      appear in sdl3.pc/SDL3Config.cmake
    - sdl_compile_definitions to add macro's
    - sdl_compile_options for compile options
    - sdl_include_directories for include directories
  They avoid repeated checks for existence of the SDL targets
- A nice feature of the previous is the ability to generate
  a sdl3.pc or SDL3Config.cmake that describes its dependencies
  accurately.

various:

- remove duplicate libc symbol list
- add CheckVulkan
- remove unused HAVE_MPROTECT
- add checks for getpagesize
2023-07-20 17:58:06 +02:00
Frank Praznik 44536b7537 Add and event and flag to report when a window has been occluded
Adds the SDL_EVENT_WINDOW_OCCLUDED events and the window flag SDL_WINDOW_OCCLUDED to report when the window occlusion state has changed, so that the application can take appropriate measures, as it may wish to suspend drawing, throttle, or otherwise behave in a more energy efficient manner when the window is not visible. When the window is no longer occluded, the SDL_EVENT_WINDOW_EXPOSED event is sent and the occlusion flag is cleared.

This is handled on macOS via the window occlusion state event (available as of 10.9), and via the xdg-shell protocol on Wayland (version 6, wayland-protocols 1.32, passed through in libdecor 0.1.2).
2023-07-18 16:42:05 -04:00
Sam Lantinga 9db2cb3513 Added SDL_ReloadGamepadMappings() to reset the SDL gamepad mappings 2023-07-18 12:50:10 -07:00
Sam Lantinga 75e7a6fcfa SDL_AddGamepadMappingsFromFile() has been made into a real function 2023-07-18 12:05:04 -07:00
Sam Lantinga 0a4e6f6d29 Added SDL_strnlen() and SDL_wcsnlen() 2023-07-17 19:37:51 -07:00
Sam Lantinga 75d4a91aaa Use SDL_GAMEPAD_TYPE_UNKNOWN, not SDL_GAMEPAD_TYPE_INVALID 2023-07-17 13:54:55 -07:00
SDL Wiki Bot 27556e098e Sync SDL3 wiki -> header 2023-07-17 20:00:18 +00:00
Sam Lantinga b271e92c6e Added the ability to specify a gamepad type in the mapping
Also renamed most cases of SDL_GAMEPAD_TYPE_UNKNOWN to SDL_GAMEPAD_TYPE_STANDARD, and SDL_GetGamepadType() will return SDL_GAMEPAD_TYPE_UNKNOWN only if the gamepad is invalid.
2023-07-17 12:59:56 -07:00
SDL Wiki Bot 74612701bb Sync SDL3 wiki -> header 2023-07-16 11:33:16 +00:00
Sam Lantinga 57cfd1e106 Removed SDL_GAMEPAD_TYPE_VIRTUAL, SDL_GAMEPAD_TYPE_AMAZON_LUNA, SDL_GAMEPAD_TYPE_GOOGLE_STADIA, and SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
Removing SDL_GAMEPAD_TYPE_VIRTUAL allows a virtual controller to emulate another gamepad type. The other controller types can be treated as generic controllers by applications without special glyph or functionality treatment.
2023-07-16 04:32:12 -07:00
Sam Lantinga f3d6320bac Added SDL_strndup() 2023-07-16 04:32:12 -07:00
Sam Lantinga a1615dea85 Added SDL_SetGamepadMapping() to set the mapping for a specific device 2023-07-16 04:32:12 -07:00
Sam Lantinga eb0955ef89 Removed SDL_GamepadBinding from the API
The text format is more expressive and widely used than the binary structure
2023-07-16 04:32:12 -07:00
Sam Lantinga 2e3404db01 Added SDL_GetGamepadPowerLevel() to get the power level directly from a gamepad 2023-07-11 10:20:08 -07:00
Sam Lantinga 3cbf16b944 Added SDL_GetGamepadInstanceID() 2023-07-10 19:13:42 -07:00
SDL Wiki Bot 550c84b4df Sync SDL3 wiki -> header 2023-07-09 20:50:16 +00:00
Sam Lantinga bea99d48f2 Changed 'freesrc' parameter from int to SDL_bool 2023-07-09 13:49:04 -07:00
Sam Lantinga 32d529bf70 Use size_t for the size of memory RWops 2023-07-09 13:36:00 -07:00
Sam Lantinga 3a654b4b1c Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers 2023-07-08 09:32:24 -07:00
Sylvain aab3cbf207 SDL_thread.h: fix parameter name in comment 2023-07-07 21:55:20 +02:00
Sylvain ec90c2e26d Add 'return' comment to SDL_ClearClipboardData 2023-07-07 10:25:06 +02:00